├── docs
├── files
│ └── .keep
├── .gitignore
├── _config-prod.yml
├── bower_components
│ ├── jquery
│ │ ├── .gitignore
│ │ ├── package.json
│ │ ├── bower.json
│ │ ├── component.json
│ │ ├── README.md
│ │ ├── .bower.json
│ │ └── composer.json
│ └── bootstrap
│ │ ├── CNAME
│ │ ├── examples
│ │ ├── navbar
│ │ │ ├── navbar.css
│ │ │ └── index.html
│ │ ├── navbar-fixed-top
│ │ │ └── navbar-fixed-top.css
│ │ ├── navbar-static-top
│ │ │ └── navbar-static-top.css
│ │ ├── screenshots
│ │ │ ├── grid.jpg
│ │ │ ├── theme.jpg
│ │ │ ├── carousel.jpg
│ │ │ ├── navbar.jpg
│ │ │ ├── sign-in.jpg
│ │ │ ├── jumbotron.jpg
│ │ │ ├── offcanvas.jpg
│ │ │ ├── justified-nav.jpg
│ │ │ ├── navbar-fixed.jpg
│ │ │ ├── navbar-static.jpg
│ │ │ ├── sticky-footer.jpg
│ │ │ ├── non-responsive.jpg
│ │ │ ├── jumbotron-narrow.jpg
│ │ │ ├── starter-template.jpg
│ │ │ └── sticky-footer-navbar.jpg
│ │ ├── starter-template
│ │ │ ├── starter-template.css
│ │ │ └── index.html
│ │ ├── jumbotron
│ │ │ └── jumbotron.css
│ │ ├── offcanvas
│ │ │ ├── offcanvas.js
│ │ │ └── offcanvas.css
│ │ ├── theme
│ │ │ └── theme.css
│ │ ├── grid
│ │ │ └── grid.css
│ │ ├── sticky-footer
│ │ │ ├── sticky-footer.css
│ │ │ └── index.html
│ │ ├── signin
│ │ │ ├── signin.css
│ │ │ └── index.html
│ │ ├── sticky-footer-navbar
│ │ │ └── sticky-footer-navbar.css
│ │ ├── jumbotron-narrow
│ │ │ ├── jumbotron-narrow.css
│ │ │ └── index.html
│ │ ├── justified-nav
│ │ │ ├── justified-nav.css
│ │ │ └── index.html
│ │ ├── non-responsive
│ │ │ └── non-responsive.css
│ │ └── carousel
│ │ │ └── carousel.css
│ │ ├── assets
│ │ ├── ico
│ │ │ ├── favicon.png
│ │ │ ├── apple-touch-icon-114-precomposed.png
│ │ │ ├── apple-touch-icon-144-precomposed.png
│ │ │ ├── apple-touch-icon-57-precomposed.png
│ │ │ └── apple-touch-icon-72-precomposed.png
│ │ ├── js
│ │ │ ├── raw-files.js
│ │ │ ├── application.js
│ │ │ └── html5shiv.js
│ │ └── css
│ │ │ └── pygments-manni.css
│ │ ├── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.ttf
│ │ └── glyphicons-halflings-regular.woff
│ │ ├── dist
│ │ └── fonts
│ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ └── glyphicons-halflings-regular.woff
│ │ ├── bower.json
│ │ ├── js
│ │ ├── .jshintrc
│ │ ├── tests
│ │ │ ├── server.js
│ │ │ ├── unit
│ │ │ │ ├── transition.js
│ │ │ │ ├── affix.js
│ │ │ │ ├── scrollspy.js
│ │ │ │ ├── alert.js
│ │ │ │ ├── phantom.js
│ │ │ │ └── tab.js
│ │ │ ├── index.html
│ │ │ └── phantom.js
│ │ ├── transition.js
│ │ ├── alert.js
│ │ └── button.js
│ │ ├── _includes
│ │ ├── ads.html
│ │ ├── old-bs-docs.html
│ │ ├── social-buttons.html
│ │ ├── nav-getting-started.html
│ │ ├── footer.html
│ │ ├── nav-main.html
│ │ ├── nav-customize.html
│ │ ├── header.html
│ │ └── nav-javascript.html
│ │ ├── less
│ │ ├── breadcrumbs.less
│ │ ├── component-animations.less
│ │ ├── wells.less
│ │ ├── thumbnails.less
│ │ ├── utilities.less
│ │ ├── close.less
│ │ ├── jumbotron.less
│ │ ├── media.less
│ │ ├── pager.less
│ │ ├── badges.less
│ │ ├── labels.less
│ │ ├── code.less
│ │ ├── bootstrap.less
│ │ ├── alerts.less
│ │ ├── print.less
│ │ ├── pagination.less
│ │ ├── list-group.less
│ │ ├── progress-bars.less
│ │ ├── scaffolding.less
│ │ └── tooltip.less
│ │ ├── composer.json
│ │ ├── .bower.json
│ │ ├── browserstack.json
│ │ ├── _config.yml
│ │ ├── package.json
│ │ ├── _layouts
│ │ ├── home.html
│ │ └── default.html
│ │ └── CONTRIBUTING.md
├── img
│ ├── favicon.png
│ ├── backbeam.png
│ ├── webmaker.png
│ ├── apostrophe.png
│ ├── apostrophe2x.png
│ ├── backbeam2x.png
│ ├── marketplace.png
│ ├── webmaker2x.png
│ └── marketplace2x.png
├── css
│ └── fonts
│ │ ├── Sullivan-Fill.eot
│ │ ├── Sullivan-Fill.svg
│ │ ├── Sullivan-Fill.ttf
│ │ └── Sullivan-Fill.woff
├── _config.yml
├── Makefile
├── js
│ └── subpage.js
├── README.md
├── _plugins
│ ├── cleanup.rb
│ ├── page_toc.rb
│ ├── api.rb
│ └── locale.rb
├── _layouts
│ ├── subpage.html
│ └── page.html
├── cn
│ ├── faq.md
│ └── getting-started.md
├── faq.md
└── fr
│ └── faq.md
├── tests
├── templates
│ ├── item.njk
│ ├── include.njk
│ ├── relative
│ │ ├── dir1
│ │ │ ├── macros.njk
│ │ │ └── index.njk
│ │ ├── dir2
│ │ │ ├── macros.njk
│ │ │ └── index.njk
│ │ ├── test-cache.njk
│ │ ├── test1.njk
│ │ └── test2.njk
│ ├── set.njk
│ ├── for-async-content.njk
│ ├── undefined-macro.njk
│ ├── async.njk
│ ├── base3.njk
│ ├── include-set.njk
│ ├── simple-base.njk
│ ├── import-context.njk
│ ├── include-in-loop.njk
│ ├── base.njk
│ ├── base2.njk
│ ├── base-inherit.njk
│ ├── base-set-wraps-block.njk
│ ├── filter-block.html
│ ├── macro-call-undefined-macro.njk
│ ├── import-context-set.njk
│ ├── import-macro-call-undefined-macro.njk
│ └── import.njk
├── express-sample
│ ├── views
│ │ ├── set.html
│ │ ├── import-context-set.html
│ │ ├── item-base.html
│ │ ├── item.html
│ │ ├── index.html
│ │ ├── about.html
│ │ └── base.html
│ ├── js
│ │ ├── app.js
│ │ └── extensions.js
│ ├── pre.js
│ └── main.js
├── express
│ └── express.js
├── browser
│ └── index.html
├── precompile.js
├── api.js
├── runtime.js
└── loader.js
├── bench
├── jinja
│ ├── index.html
│ └── jinja.py
├── index.html
└── run.js
├── .npmignore
├── .gitignore
├── bin
├── precompile.cmd
├── bundle
├── bundle.js
└── precompile
├── .travis.yml
├── src
├── loaders.js
├── precompiled-loader.js
├── precompile-global.js
├── loader.js
├── object.js
├── globals.js
├── node-loaders.js
└── web-loaders.js
├── .jshintignore
├── bower.json
├── .jshintrc
├── contribute.json
├── appveyor.yml
├── CONTRIBUTING.md
├── package.json
├── README.md
├── LICENSE
├── MAINTENANCE.md
└── index.js
/docs/files/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | _site
2 | .DS_Store
3 |
--------------------------------------------------------------------------------
/docs/_config-prod.yml:
--------------------------------------------------------------------------------
1 | baseurl: /nunjucks/
--------------------------------------------------------------------------------
/tests/templates/item.njk:
--------------------------------------------------------------------------------
1 | showing {{ item }}
--------------------------------------------------------------------------------
/tests/templates/include.njk:
--------------------------------------------------------------------------------
1 | FooInclude {{ name }}
--------------------------------------------------------------------------------
/tests/templates/relative/dir1/macros.njk:
--------------------------------------------------------------------------------
1 | Test1
--------------------------------------------------------------------------------
/tests/templates/relative/dir2/macros.njk:
--------------------------------------------------------------------------------
1 | Test2
--------------------------------------------------------------------------------
/tests/templates/set.njk:
--------------------------------------------------------------------------------
1 | {% set foo = "mumble" %}
--------------------------------------------------------------------------------
/docs/bower_components/jquery/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 |
--------------------------------------------------------------------------------
/tests/templates/for-async-content.njk:
--------------------------------------------------------------------------------
1 | somecontenthere
--------------------------------------------------------------------------------
/tests/templates/undefined-macro.njk:
--------------------------------------------------------------------------------
1 | {{ undef() }}
2 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/CNAME:
--------------------------------------------------------------------------------
1 | getbootstrap.com
2 |
--------------------------------------------------------------------------------
/tests/templates/async.njk:
--------------------------------------------------------------------------------
1 | {{ tmpl | getContents }}
2 |
--------------------------------------------------------------------------------
/bench/jinja/index.html:
--------------------------------------------------------------------------------
1 | {% for x in foo %}{{ x }}{% endfor %}
2 |
--------------------------------------------------------------------------------
/tests/express-sample/views/set.html:
--------------------------------------------------------------------------------
1 | {% set username = "foooo" %}
2 |
--------------------------------------------------------------------------------
/tests/templates/base3.njk:
--------------------------------------------------------------------------------
1 | {% block block1 %}Foo {% endblock %}
--------------------------------------------------------------------------------
/tests/templates/relative/dir1/index.njk:
--------------------------------------------------------------------------------
1 | {% include "./macros.njk" %}
--------------------------------------------------------------------------------
/tests/templates/relative/dir2/index.njk:
--------------------------------------------------------------------------------
1 | {% include "./macros.njk" %}
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | coverage
3 | docs
4 | tests
5 | bench
6 |
--------------------------------------------------------------------------------
/tests/templates/include-set.njk:
--------------------------------------------------------------------------------
1 | {{ var }}{% set var = 2 %}{{ var }}
2 |
--------------------------------------------------------------------------------
/tests/templates/simple-base.njk:
--------------------------------------------------------------------------------
1 | {% block test %}{% endblock test %}
2 |
--------------------------------------------------------------------------------
/tests/express-sample/views/import-context-set.html:
--------------------------------------------------------------------------------
1 | {% set bar = "FOO" %}
2 |
--------------------------------------------------------------------------------
/tests/templates/import-context.njk:
--------------------------------------------------------------------------------
1 | {% macro foo() %}Here's {{ bar }}{% endmacro %}
--------------------------------------------------------------------------------
/tests/templates/include-in-loop.njk:
--------------------------------------------------------------------------------
1 | {{ loop.index }},{{ loop.index0 }},{{ loop.first }}
2 |
--------------------------------------------------------------------------------
/docs/img/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/img/favicon.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | package-lock.json
2 | node_modules
3 | coverage
4 | .#*
5 | docs/_site
6 | docs/files
7 |
--------------------------------------------------------------------------------
/docs/img/backbeam.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/img/backbeam.png
--------------------------------------------------------------------------------
/docs/img/webmaker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/img/webmaker.png
--------------------------------------------------------------------------------
/tests/templates/base.njk:
--------------------------------------------------------------------------------
1 | Foo{% block block1 %}Bar{% endblock %}{% block block2 %}Baz{% endblock %}Fizzle
--------------------------------------------------------------------------------
/tests/templates/base2.njk:
--------------------------------------------------------------------------------
1 | {% for item in [1,2] %}{% block item %}{{ item }}{% endblock %}{% endfor %}
--------------------------------------------------------------------------------
/docs/img/apostrophe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/img/apostrophe.png
--------------------------------------------------------------------------------
/docs/img/apostrophe2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/img/apostrophe2x.png
--------------------------------------------------------------------------------
/docs/img/backbeam2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/img/backbeam2x.png
--------------------------------------------------------------------------------
/docs/img/marketplace.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/img/marketplace.png
--------------------------------------------------------------------------------
/docs/img/webmaker2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/img/webmaker2x.png
--------------------------------------------------------------------------------
/tests/templates/relative/test-cache.njk:
--------------------------------------------------------------------------------
1 | {% include "./dir1/index.njk" %}
2 | {% include "./dir2/index.njk" %}
--------------------------------------------------------------------------------
/docs/img/marketplace2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/img/marketplace2x.png
--------------------------------------------------------------------------------
/tests/templates/relative/test1.njk:
--------------------------------------------------------------------------------
1 | {% extends "../base.njk" %}
2 |
3 | {% block block1 %}Test1{% endblock %}
4 |
--------------------------------------------------------------------------------
/tests/templates/relative/test2.njk:
--------------------------------------------------------------------------------
1 | {% extends "./test1.njk" %}
2 |
3 | {% block block1 %}Test2{% endblock %}
4 |
--------------------------------------------------------------------------------
/tests/templates/base-inherit.njk:
--------------------------------------------------------------------------------
1 | {% extends "base.njk" %}
2 |
3 | {% block block1 %}*{{ super() }}*{% endblock %}
4 |
--------------------------------------------------------------------------------
/docs/css/fonts/Sullivan-Fill.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/css/fonts/Sullivan-Fill.eot
--------------------------------------------------------------------------------
/docs/css/fonts/Sullivan-Fill.svg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/css/fonts/Sullivan-Fill.svg
--------------------------------------------------------------------------------
/docs/css/fonts/Sullivan-Fill.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/css/fonts/Sullivan-Fill.ttf
--------------------------------------------------------------------------------
/tests/templates/base-set-wraps-block.njk:
--------------------------------------------------------------------------------
1 | {% set somevar %}{% block somevar %}{% endblock %}{% endset %}{{ somevar }}
2 |
--------------------------------------------------------------------------------
/docs/css/fonts/Sullivan-Fill.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/css/fonts/Sullivan-Fill.woff
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/navbar/navbar.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 30px;
3 | }
4 |
5 | .navbar {
6 | margin-bottom: 30px;
7 | }
--------------------------------------------------------------------------------
/bin/precompile.cmd:
--------------------------------------------------------------------------------
1 | @IF EXIST "%~dp0\node.exe" (
2 | "%~dp0\node.exe" "%~dp0\precompile" %*
3 | ) ELSE (
4 | node "%~dp0\precompile" %*
5 | )
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/navbar-fixed-top/navbar-fixed-top.css:
--------------------------------------------------------------------------------
1 | body {
2 | min-height: 2000px;
3 | padding-top: 70px;
4 | }
5 |
--------------------------------------------------------------------------------
/tests/templates/filter-block.html:
--------------------------------------------------------------------------------
1 | may the {% filter replace("force", "forth") %}{% block block1 %}bar{% endblock %}{% endfilter %} be with you
2 |
--------------------------------------------------------------------------------
/tests/templates/macro-call-undefined-macro.njk:
--------------------------------------------------------------------------------
1 | {% macro defined_macro(useless) %}
2 | {% include "undefined-macro.njk" %}
3 | {% endmacro %}
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "6"
4 | - "5"
5 | - "4"
6 | - "1"
7 | - "0.12"
8 | - "0.11"
9 | - "0.10"
10 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | encoding: utf-8
2 | markdown: redcarpet
3 | highlighter: pygments
4 | redcarpet:
5 | extensions: [with_toc_data]
6 |
7 | baseurl: /
8 |
--------------------------------------------------------------------------------
/src/loaders.js:
--------------------------------------------------------------------------------
1 | // This file will automatically be rewired to web-loader.js when
2 | // building for the browser
3 | module.exports = require('./node-loaders');
4 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/assets/ico/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/assets/ico/favicon.png
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/assets/js/raw-files.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/assets/js/raw-files.js
--------------------------------------------------------------------------------
/tests/express-sample/views/item-base.html:
--------------------------------------------------------------------------------
1 |
2 | Editing item: {{ name }}
3 |
4 | {% block description %}
5 | A basic description is: {{ desc }}
6 | {% endblock %}
7 |
--------------------------------------------------------------------------------
/tests/templates/import-context-set.njk:
--------------------------------------------------------------------------------
1 | {% set bar = "FOO" %}
2 |
3 | {# create a new scope #}
4 | {% for i in [1] %}
5 | {% set buzz = "buzz" %}
6 | {% endfor %}
7 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/navbar-static-top/navbar-static-top.css:
--------------------------------------------------------------------------------
1 | body {
2 | min-height: 2000px;
3 | }
4 |
5 | .navbar-static-top {
6 | margin-bottom: 19px;
7 | }
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/grid.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/grid.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/theme.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/theme.jpg
--------------------------------------------------------------------------------
/tests/templates/import-macro-call-undefined-macro.njk:
--------------------------------------------------------------------------------
1 | {% import 'macro-call-undefined-macro.njk' as t %}
2 | {% for el in list %}
3 | {{ t.defined_macro() }}
4 | {% endfor %}
5 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/carousel.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/carousel.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/navbar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/navbar.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/sign-in.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/sign-in.jpg
--------------------------------------------------------------------------------
/tests/templates/import.njk:
--------------------------------------------------------------------------------
1 | {% macro foo() %}Here's a macro{% endmacro %}
2 |
3 | {% set bar = 'baz' %}
4 |
5 | {% macro wrap(el) %}<{{ el }}>{{ caller() }}{{ el }}>{% endmacro %}
6 |
--------------------------------------------------------------------------------
/.jshintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | spm_modules
3 | coverage
4 | dist
5 | browser
6 | docs
7 | tests/express-sample
8 | tests/express
9 | tests/browser
10 | bench
11 | src/loaders.js
12 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 |
2 | all:
3 | jekyll serve --watch
4 |
5 | prod:
6 | cp ../browser/* files
7 | rsync -avz ../tests/ files/tests
8 | jekyll build --config _config.yml,_config-prod.yml
9 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/jumbotron.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/jumbotron.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/offcanvas.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/offcanvas.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/justified-nav.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/justified-nav.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/navbar-fixed.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/navbar-fixed.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/navbar-static.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/navbar-static.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/sticky-footer.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/sticky-footer.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/tests/express-sample/js/app.js:
--------------------------------------------------------------------------------
1 |
2 | nunjucks.configure('views', { autoescape: true });
3 |
4 | // aboutTmpl({ poop: 'pooop<><>' }, function(err, res) {
5 | // console.log(res);
6 | // });
7 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/non-responsive.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/non-responsive.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/starter-template/starter-template.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | }
4 | .starter-template {
5 | padding: 40px 15px;
6 | text-align: center;
7 | }
8 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/jumbotron-narrow.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/jumbotron-narrow.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/starter-template.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/starter-template.jpg
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/jumbotron/jumbotron.css:
--------------------------------------------------------------------------------
1 | /* Move down content because we have a fixed navbar that is 50px tall */
2 | body {
3 | padding-top: 50px;
4 | padding-bottom: 20px;
5 | }
6 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/screenshots/sticky-footer-navbar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/examples/screenshots/sticky-footer-navbar.jpg
--------------------------------------------------------------------------------
/docs/bower_components/jquery/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "components-jquery",
3 | "version": "2.0.3",
4 | "description": "jQuery component",
5 | "keywords": ["jquery"],
6 | "main": "./jquery.js"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/express-sample/views/item.html:
--------------------------------------------------------------------------------
1 | {% extends "item-base.njk" %}
2 |
3 | {% block description %}
4 | I told you, it's name is {{ name }}.
5 |
6 | It also has the description: {{ desc }}.
7 | {% endblock %}
8 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | ROOT=`dirname $0`
4 |
5 | $ROOT/bundle.js nunjucks.js
6 | $ROOT/bundle.js -m nunjucks.min.js
7 | $ROOT/bundle.js -s nunjucks-slim.js
8 | $ROOT/bundle.js -m -s nunjucks-slim.min.js
9 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/assets/ico/apple-touch-icon-114-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/assets/ico/apple-touch-icon-114-precomposed.png
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/assets/ico/apple-touch-icon-144-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/assets/ico/apple-touch-icon-144-precomposed.png
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/assets/ico/apple-touch-icon-57-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/assets/ico/apple-touch-icon-57-precomposed.png
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/assets/ico/apple-touch-icon-72-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apostrophecms/nunjucks/HEAD/docs/bower_components/bootstrap/assets/ico/apple-touch-icon-72-precomposed.png
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/offcanvas/offcanvas.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | $('[data-toggle=offcanvas]').click(function() {
3 | $('.row-offcanvas').toggleClass('active');
4 | });
5 | });
--------------------------------------------------------------------------------
/tests/express-sample/views/index.html:
--------------------------------------------------------------------------------
1 | {% extends "base.njk" %}
2 |
3 | {% block content %}
4 | Hello, {{ username | default('poop') }}! This is just some content.
5 |
6 |
7 | {% endblock %}
8 |
--------------------------------------------------------------------------------
/docs/bower_components/jquery/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery",
3 | "version": "2.0.3",
4 | "description": "jQuery component",
5 | "keywords": [
6 | "jquery",
7 | "component"
8 | ],
9 | "main": "jquery.js",
10 | "license": "MIT"
11 | }
12 |
--------------------------------------------------------------------------------
/tests/express-sample/views/about.html:
--------------------------------------------------------------------------------
1 | {% extends "base.njk" %}
2 |
3 | {% block content %}
4 | This is just the about page
5 | {% endblock %}
6 |
7 | {% block footer %}
8 | {{ super() }}
9 | You really should read this!
10 |
11 | {{ poop }}
12 | {% endblock %}
13 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap",
3 | "version": "3.0.0",
4 | "main": ["./dist/js/bootstrap.js", "./dist/css/bootstrap.css"],
5 | "ignore": [
6 | "**/.*"
7 | ],
8 | "dependencies": {
9 | "jquery": ">= 1.9.0"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/theme/theme.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 70px;
3 | padding-bottom: 30px;
4 | }
5 |
6 | .theme-dropdown .dropdown-menu {
7 | display: block;
8 | position: static;
9 | margin-bottom: 20px;
10 | }
11 |
12 | .theme-showcase > p > .btn {
13 | margin: 5px 0;
14 | }
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nunjucks",
3 | "main": "browser/nunjucks.min.js",
4 | "ignore": [
5 | "Makefile",
6 | "package.json",
7 | "tests",
8 | "docs",
9 | "index.js"
10 | ],
11 | "keywords": [
12 | "jinja",
13 | "template",
14 | "templates",
15 | "templating",
16 | "browser"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/docs/bower_components/jquery/component.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery",
3 | "repo": "components/jquery",
4 | "version": "2.0.3",
5 | "description": "jQuery component",
6 | "keywords": [
7 | "jquery",
8 | "component"
9 | ],
10 | "main": "jquery.js",
11 | "scripts": [
12 | "jquery.js"
13 | ],
14 | "license": "MIT"
15 | }
16 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "validthis": true,
3 | "laxcomma" : true,
4 | "laxbreak" : true,
5 | "browser" : true,
6 | "eqeqeq" : false,
7 | "eqnull" : true,
8 | "debug" : true,
9 | "devel" : true,
10 | "curly" : false,
11 | "boss" : true,
12 | "expr" : true,
13 | "asi" : true
14 | }
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_includes/ads.html:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/docs/js/subpage.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 |
3 | var toc = $('.toc');
4 | if(toc.length) {
5 | var base = $('body')[0].getBoundingClientRect().top;
6 | var top = toc[0].getBoundingClientRect().top;
7 |
8 | toc.affix({
9 | offset: {
10 | top: top - base
11 | }
12 | });
13 | }
14 |
15 | });
16 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_includes/old-bs-docs.html:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/docs/bower_components/jquery/README.md:
--------------------------------------------------------------------------------
1 | jQuery Component
2 | ================
3 |
4 | Shim repository for the [jQuery](http://jquery.com).
5 |
6 | Package Managers
7 | ----------------
8 |
9 | * [Bower](http://bower.io/): `jquery`
10 | * [Component](https://github.com/component/component): `components/jquery`
11 | * [Composer](http://packagist.org/packages/components/jquery): `components/jquery`
12 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/tests/server.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Simple connect server for phantom.js
3 | * Adapted from Modernizr
4 | */
5 |
6 | var connect = require('connect')
7 | , http = require('http')
8 | , fs = require('fs')
9 | , app = connect()
10 | .use(connect.static(__dirname + '/../../'));
11 |
12 | http.createServer(app).listen(3000);
13 |
14 | fs.writeFileSync(__dirname + '/pid.txt', process.pid, 'utf-8')
15 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 |
2 | This is a jekyll site that generates the docs for
3 | [nunjucks](https://github.com/mozilla/nunjucks). If you find a bug
4 | in the docs, please file an issue, or even better, fork it and fix it!
5 |
6 | Run `make` to publish and look it at locally.
7 |
8 | Run `make prod` to publish the production version, and then push the
9 | generated `_site` folder on the `gh-pages` branch of the
10 | [nunjucks](https://github.com/mozilla/nunjucks) repo.
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/tests/unit/transition.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 |
3 | module("transition")
4 |
5 | test("should be defined on jquery support object", function () {
6 | ok($.support.transition !== undefined, 'transition object is defined')
7 | })
8 |
9 | test("should provide an end object", function () {
10 | ok($.support.transition ? $.support.transition.end : true, 'end string is defined')
11 | })
12 |
13 | })
14 |
--------------------------------------------------------------------------------
/tests/express-sample/pre.js:
--------------------------------------------------------------------------------
1 | var precompileString = require('../../index').precompileString;
2 | var fs = require('fs');
3 |
4 | var out = 'window.baseTmpl = ' +
5 | precompileString(fs.readFileSync('views/base.njk', 'utf-8'), {
6 | name: 'base.njk',
7 | asFunction: true
8 | });
9 |
10 | out += 'window.aboutTmpl = ' +
11 | precompileString(fs.readFileSync('views/about.njk', 'utf-8'), {
12 | name: 'about.njk',
13 | asFunction: true
14 | });
15 |
16 | fs.writeFileSync('js/templates.js', out, 'utf-8');
17 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/grid/grid.css:
--------------------------------------------------------------------------------
1 | .container {
2 | padding-left: 15px;
3 | padding-right: 15px;
4 | }
5 |
6 | h4 {
7 | margin-top: 25px;
8 | }
9 | .row {
10 | margin-bottom: 20px;
11 | }
12 | .row .row {
13 | margin-top: 10px;
14 | margin-bottom: 0;
15 | }
16 | [class*="col-"] {
17 | padding-top: 15px;
18 | padding-bottom: 15px;
19 | background-color: #eee;
20 | border: 1px solid #ddd;
21 | background-color: rgba(86,61,124,.15);
22 | border: 1px solid rgba(86,61,124,.2);
23 | }
24 |
25 | hr {
26 | margin-top: 40px;
27 | margin-bottom: 40px;
28 | }
--------------------------------------------------------------------------------
/docs/bower_components/jquery/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery",
3 | "version": "2.0.3",
4 | "description": "jQuery component",
5 | "keywords": [
6 | "jquery",
7 | "component"
8 | ],
9 | "main": "jquery.js",
10 | "license": "MIT",
11 | "homepage": "https://github.com/components/jquery",
12 | "_release": "2.0.3",
13 | "_resolution": {
14 | "type": "version",
15 | "tag": "2.0.3",
16 | "commit": "452a56b52b8f4a032256cdb8b6838f25f0bdb3d2"
17 | },
18 | "_source": "git://github.com/components/jquery.git",
19 | "_target": ">= 1.9.0",
20 | "_originalSource": "jquery"
21 | }
--------------------------------------------------------------------------------
/src/precompiled-loader.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var Loader = require('./loader');
4 |
5 | var PrecompiledLoader = Loader.extend({
6 | init: function(compiledTemplates) {
7 | this.precompiled = compiledTemplates || {};
8 | },
9 |
10 | getSource: function(name) {
11 | if (this.precompiled[name]) {
12 | return {
13 | src: { type: 'code',
14 | obj: this.precompiled[name] },
15 | path: name
16 | };
17 | }
18 | return null;
19 | }
20 | });
21 |
22 | module.exports = PrecompiledLoader;
23 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/breadcrumbs.less:
--------------------------------------------------------------------------------
1 | //
2 | // Breadcrumbs
3 | // --------------------------------------------------
4 |
5 |
6 | .breadcrumb {
7 | padding: 8px 15px;
8 | margin-bottom: @line-height-computed;
9 | list-style: none;
10 | background-color: @breadcrumb-bg;
11 | border-radius: @border-radius-base;
12 | > li {
13 | display: inline-block;
14 | &+li:before {
15 | content: "/\00a0"; // Unicode space added since inline-block means non-collapsing white-space
16 | padding: 0 5px;
17 | color: @breadcrumb-color;
18 | }
19 | }
20 | > .active {
21 | color: @breadcrumb-active-color;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "twbs/bootstrap"
3 | , "description": "Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development."
4 | , "keywords": ["bootstrap", "css"]
5 | , "homepage": "http://getbootstrap.com"
6 | , "authors": [
7 | {
8 | "name": "Mark Otto",
9 | "email": "markdotto@gmail.com"
10 | },
11 | {
12 | "name": "Jacob Thornton",
13 | "email": "jacobthornton@gmail.com"
14 | }
15 | ]
16 | , "support": {
17 | "issues": "https://github.com/twbs/bootstrap/issues"
18 | }
19 | , "license": "Apache-2.0"
20 | }
21 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "latedef": "nofunc",
3 | "newcap": false,
4 | "curly": false,
5 | "eqeqeq": true,
6 | "eqnull": true,
7 | "strict": true,
8 | "undef": true,
9 | "unused": true,
10 | "laxcomma": false,
11 | "asi": false,
12 | "boss": true,
13 | "expr": true,
14 | "sub": true,
15 | "quotmark": true,
16 | "laxbreak": true,
17 | "loopfunc": false,
18 | "lastsemic": true,
19 | "funcscope": false,
20 | "esnext": true,
21 | "noyield": true,
22 | "browser": true,
23 | "nonstandard": true,
24 | "jquery": true,
25 | "devel": true,
26 | "node": true,
27 | "mocha": true,
28 | "globals": {
29 | "nunjucks": false
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap",
3 | "version": "3.0.0",
4 | "main": [
5 | "./dist/js/bootstrap.js",
6 | "./dist/css/bootstrap.css"
7 | ],
8 | "ignore": [
9 | "**/.*"
10 | ],
11 | "dependencies": {
12 | "jquery": ">= 1.9.0"
13 | },
14 | "homepage": "https://github.com/twbs/bootstrap",
15 | "_release": "3.0.0",
16 | "_resolution": {
17 | "type": "version",
18 | "tag": "v3.0.0",
19 | "commit": "e8a1df5f060bf7e6631554648e0abde150aedbe4"
20 | },
21 | "_source": "git://github.com/twbs/bootstrap.git",
22 | "_target": "~3.0.0",
23 | "_originalSource": "bootstrap",
24 | "_direct": true
25 | }
--------------------------------------------------------------------------------
/tests/express-sample/views/base.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | A quick app
5 |
6 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | {% block content %}{% endblock %}
23 |
24 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/component-animations.less:
--------------------------------------------------------------------------------
1 | //
2 | // Component animations
3 | // --------------------------------------------------
4 |
5 | // Heads up!
6 | //
7 | // We don't use the `.opacity()` mixin here since it causes a bug with text
8 | // fields in IE7-8. Source: https://github.com/twitter/bootstrap/pull/3552.
9 |
10 | .fade {
11 | opacity: 0;
12 | .transition(opacity .15s linear);
13 | &.in {
14 | opacity: 1;
15 | }
16 | }
17 |
18 | .collapse {
19 | display: none;
20 | &.in {
21 | display: block;
22 | }
23 | }
24 | .collapsing {
25 | position: relative;
26 | height: 0;
27 | overflow: hidden;
28 | .transition(height .35s ease);
29 | }
30 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/wells.less:
--------------------------------------------------------------------------------
1 | //
2 | // Wells
3 | // --------------------------------------------------
4 |
5 |
6 | // Base class
7 | .well {
8 | min-height: 20px;
9 | padding: 19px;
10 | margin-bottom: 20px;
11 | background-color: @well-bg;
12 | border: 1px solid darken(@well-bg, 7%);
13 | border-radius: @border-radius-base;
14 | .box-shadow(inset 0 1px 1px rgba(0,0,0,.05));
15 | blockquote {
16 | border-color: #ddd;
17 | border-color: rgba(0,0,0,.15);
18 | }
19 | }
20 |
21 | // Sizes
22 | .well-lg {
23 | padding: 24px;
24 | border-radius: @border-radius-large;
25 | }
26 | .well-sm {
27 | padding: 9px;
28 | border-radius: @border-radius-small;
29 | }
30 |
--------------------------------------------------------------------------------
/tests/express-sample/main.js:
--------------------------------------------------------------------------------
1 | var nunjucks = require('../../index');
2 | var express = require('express');
3 |
4 | var app = express();
5 | nunjucks.configure('views', { autoescape: true,
6 | express: app,
7 | watch: true });
8 |
9 | // app
10 |
11 | app.use(express.static(__dirname));
12 |
13 | app.use(function(req, res, next) {
14 | res.locals.user = 'hello';
15 | next();
16 | });
17 |
18 | app.get('/', function(req, res) {
19 | res.render('index.njk', { username: 'James Long copyright ' });
20 | });
21 |
22 | app.get('/about', function(req, res) {
23 | res.render('about.njk');
24 | });
25 |
26 | app.listen(4000);
27 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/thumbnails.less:
--------------------------------------------------------------------------------
1 | //
2 | // Thumbnails
3 | // --------------------------------------------------
4 |
5 |
6 | // Mixin and adjust the regular image class
7 | .thumbnail {
8 | .img-thumbnail();
9 | display: block; // Override the inline-block from `.img-thumbnail`
10 |
11 | > img {
12 | .img-responsive();
13 | }
14 | }
15 |
16 |
17 | // Add a hover state for linked versions only
18 | a.thumbnail:hover,
19 | a.thumbnail:focus {
20 | border-color: @link-color;
21 | }
22 |
23 | // Images and captions
24 | .thumbnail > img {
25 | margin-left: auto;
26 | margin-right: auto;
27 | }
28 | .thumbnail .caption {
29 | padding: @thumbnail-caption-padding;
30 | color: @thumbnail-caption-color;
31 | }
32 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/utilities.less:
--------------------------------------------------------------------------------
1 | //
2 | // Utility classes
3 | // --------------------------------------------------
4 |
5 |
6 | // Floats
7 | // -------------------------
8 |
9 | .clearfix {
10 | .clearfix();
11 | }
12 | .pull-right {
13 | float: right !important;
14 | }
15 | .pull-left {
16 | float: left !important;
17 | }
18 |
19 |
20 | // Toggling content
21 | // -------------------------
22 |
23 | .hide {
24 | display: none !important;
25 | }
26 | .show {
27 | display: block !important;
28 | }
29 | .invisible {
30 | visibility: hidden;
31 | }
32 | .text-hide {
33 | .hide-text();
34 | }
35 |
36 |
37 | // For Affix plugin
38 | // -------------------------
39 |
40 | .affix {
41 | position: fixed;
42 | }
43 |
--------------------------------------------------------------------------------
/contribute.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Nunjucks",
3 | "description": "Nunjucks is a full featured templating engine for javascript. It is heavily inspired by jinja2.",
4 | "repository": {
5 | "url": "https://github.com/mozilla/nunjucks",
6 | "license": "BSD 2-Clause",
7 | "tests": "https://travis-ci.org/mozilla/nunjucks"
8 | },
9 | "participate": {
10 | "home": "https://github.com/mozilla/nunjucks",
11 | "docs": "https://github.com/mozilla/nunjucks"
12 | },
13 | "bugs": {
14 | "list": "https://github.com/mozilla/nunjucks/issues",
15 | "report": "https://github.com/mozilla/nunjucks/issues/new"
16 | },
17 | "keywords": [
18 | "javascript",
19 | "node.js",
20 | "jinja"
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/docs/_plugins/cleanup.rb:
--------------------------------------------------------------------------------
1 |
2 | module Jekyll
3 | module Converters
4 | class Markdown
5 | def convert(content)
6 | setup
7 | content = @parser.convert(content)
8 | names = {}
9 |
10 | content.gsub(/toc_\d*">([^<]*)/) {
11 | name = $1
12 | slug = name.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
13 |
14 | if names.has_key?(slug)
15 | i = 1
16 | newSlug = slug + i.to_s
17 | while names.has_key?(newSlug)
18 | i = i + 1
19 | newSlug = slug + i.to_s
20 | end
21 | slug = newSlug
22 | end
23 |
24 | names[slug] = true
25 | slug + '">' + name
26 | }
27 | end
28 | end
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/src/precompile-global.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | function precompileGlobal(templates, opts) {
4 | var out = '', name, template;
5 | opts = opts || {};
6 |
7 | for ( var i = 0; i < templates.length; i++ ) {
8 | name = JSON.stringify(templates[i].name);
9 | template = templates[i].template;
10 |
11 | out += '(function() {' +
12 | '(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})' +
13 | '[' + name + '] = (function() {\n' + template + '\n})();\n';
14 |
15 | if(opts.asFunction) {
16 | out += 'return function(ctx, cb) { return nunjucks.render(' + name + ', ctx, cb); }\n';
17 | }
18 |
19 | out += '})();\n';
20 | }
21 | return out;
22 | }
23 |
24 | module.exports = precompileGlobal;
25 |
--------------------------------------------------------------------------------
/docs/_layouts/subpage.html:
--------------------------------------------------------------------------------
1 | ---
2 | layout: page
3 | ---
4 |
5 |
6 |
7 |
8 |
Documentation
9 |
10 |
16 |
17 |
18 |
19 |
{{ page.title }}
20 | {% page_toc %}
21 |
22 |
23 |
24 |
25 |
{{ page.url | locale_buttons: site.baseurl }}
26 | {{ content }}
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/docs/cn/faq.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: subpage
3 | title: FAQ
4 | pageid: faq
5 | ---
6 | {% raw %}
7 |
8 | # 常见问题
9 |
10 | ## nunjucks 是否可同时在 node 端和浏览器端使用?
11 |
12 | 是.
13 |
14 | ## 是否可在 nunjucks 和 jinja2 使用同一个模板?两者有什么区别?
15 |
16 | 有一些区别。
17 |
18 | 首先,nunjucks 可以操作原生的 Javascript 而 [jinja2](http://jinja.pocoo.org/) 操作的是 python,比如在 nunjucks 中布尔值为 `true` 而 jinja2 为 `True`,在调用数组原生方法的时候也不同。
19 |
20 | 但是,如果你避免使用原生语言的特性(如 `{{ str.trim() }}`) 而完全使用模板的特性和过滤器,那么两者的模块可以兼容。
21 |
22 | Nunjucks 支持与 Jinja 兼容,查看 [installJinjaCompat](/api.html#installjinjacompat) 获取更多信息。
23 |
24 | 除此之外,nunjucks 还有一些未实现的功能:
25 |
26 | * `self` 变量
27 | * `for` 不支持 `if not` and `else`
28 | * `if i is divisibleby(3)` 式的条件判断
29 | * 可命名的结束区块: `{% endblock content %}`
30 | * 沙箱模式 (Sandboxed mode)
31 | * 行语句: `# for item in seq`
32 |
33 | 最后,自定义的 python 过滤器和扩展需要用 Javascript 重写。
34 |
35 | {% endraw %}
36 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/close.less:
--------------------------------------------------------------------------------
1 | //
2 | // Close icons
3 | // --------------------------------------------------
4 |
5 |
6 | .close {
7 | float: right;
8 | font-size: (@font-size-base * 1.5);
9 | font-weight: @close-font-weight;
10 | line-height: 1;
11 | color: @close-color;
12 | text-shadow: @close-text-shadow;
13 | .opacity(.2);
14 |
15 | &:hover,
16 | &:focus {
17 | color: @close-color;
18 | text-decoration: none;
19 | cursor: pointer;
20 | .opacity(.5);
21 | }
22 |
23 | // Additional properties for button version
24 | // iOS requires the button element instead of an anchor tag.
25 | // If you want the anchor version, it requires `href="#"`.
26 | button& {
27 | padding: 0;
28 | cursor: pointer;
29 | background: transparent;
30 | border: 0;
31 | -webkit-appearance: none;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | # Fix line endings in Windows. (runs before repo cloning)
2 | init:
3 | - git config --global core.autocrlf input
4 |
5 | # Test against these versions of Node.js.
6 | environment:
7 | matrix:
8 | - nodejs_version: "6"
9 | - nodejs_version: "5"
10 | - nodejs_version: "4"
11 | - nodejs_version: "1"
12 | - nodejs_version: "0.12"
13 | - nodejs_version: "0.11"
14 | - nodejs_version: "0.10"
15 |
16 | # Install scripts. (runs after repo cloning)
17 | install:
18 | # Get the latest stable version of Node.js or io.js
19 | - ps: Install-Product node $env:nodejs_version
20 | # install modules
21 | - npm install
22 |
23 | # Post-install test scripts.
24 | test_script:
25 | # Output useful info for debugging.
26 | - node --version
27 | - npm --version
28 | # run tests
29 | - npm test
30 |
31 | # Don't actually build.
32 | build: off
33 |
--------------------------------------------------------------------------------
/bench/jinja/jinja.py:
--------------------------------------------------------------------------------
1 |
2 | import time
3 | from jinja2 import Template, Environment, FileSystemLoader
4 |
5 | env = Environment(loader=FileSystemLoader('.'))
6 | print env.get_template('index.html').render()
7 |
8 | # src = open('index.html').read()
9 |
10 | # print(env._generate(env._parse(src, 'poop', 'hello.html'),
11 | # 'poop',
12 | # 'hello.html'))
13 |
14 | # print([x for x in env._tokenize(src, 'poop', 'hello.html')])
15 |
16 | # env = Environment(loader=FileSystemLoader('.'))
17 | # times = []
18 | # arr = [5]*1000
19 |
20 | # for i in range(100):
21 | # env = Environment(loader=FileSystemLoader('.'))
22 | # t1 = time.time()
23 | # tmpl = env.get_template('index.html')
24 | # tmpl.render({'username': 'james',
25 | # 'arr': arr})
26 | # t2 = time.time()
27 |
28 | # times.append(t2-t1)
29 |
30 | # print( reduce(lambda x, y: x+y, times) / len(times))
31 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/tests/unit/affix.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 |
3 | module("affix")
4 |
5 | test("should provide no conflict", function () {
6 | var affix = $.fn.affix.noConflict()
7 | ok(!$.fn.affix, 'affix was set back to undefined (org value)')
8 | $.fn.affix = affix
9 | })
10 |
11 | test("should be defined on jquery object", function () {
12 | ok($(document.body).affix, 'affix method is defined')
13 | })
14 |
15 | test("should return element", function () {
16 | ok($(document.body).affix()[0] == document.body, 'document.body returned')
17 | })
18 |
19 | test("should exit early if element is not visible", function () {
20 | var $affix = $('
').affix()
21 | $affix.data('bs.affix').checkPosition()
22 | ok(!$affix.hasClass('affix'), 'affix class was not added')
23 | })
24 |
25 | })
26 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/browserstack.json:
--------------------------------------------------------------------------------
1 | {
2 | "username": "--secure--",
3 | "key": "--secure--",
4 | "test_path": "js/tests/index.html",
5 | "browsers": [
6 | {
7 | "browser": "firefox",
8 | "browser_version": "latest",
9 | "os": "OS X",
10 | "os_version": "Mountain Lion"
11 | },
12 | {
13 | "browser": "safari",
14 | "browser_version": "latest",
15 | "os": "OS X",
16 | "os_version": "Mountain Lion"
17 | },
18 | {
19 | "browser": "chrome",
20 | "browser_version": "latest",
21 | "os": "OS X",
22 | "os_version": "Mountain Lion"
23 | },
24 | {
25 | "browser": "firefox",
26 | "browser_version": "latest",
27 | "os": "Windows",
28 | "os_version": "7"
29 | },
30 | {
31 | "browser": "chrome",
32 | "browser_version": "latest",
33 | "os": "Windows",
34 | "os_version": "7"
35 | }
36 | ]
37 | }
38 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/sticky-footer/sticky-footer.css:
--------------------------------------------------------------------------------
1 | /* Sticky footer styles
2 | -------------------------------------------------- */
3 |
4 | html,
5 | body {
6 | height: 100%;
7 | /* The html and body elements cannot have any padding or margin. */
8 | }
9 |
10 | /* Wrapper for page content to push down footer */
11 | #wrap {
12 | min-height: 100%;
13 | height: auto !important;
14 | height: 100%;
15 | /* Negative indent footer by its height */
16 | margin: 0 auto -60px;
17 | /* Pad bottom by footer height */
18 | padding: 0 0 60px;
19 | }
20 |
21 | /* Set the fixed height of the footer here */
22 | #footer {
23 | height: 60px;
24 | background-color: #f5f5f5;
25 | }
26 |
27 |
28 | /* Custom page CSS
29 | -------------------------------------------------- */
30 | /* Not required for template or sticky footer method. */
31 |
32 | .container {
33 | width: auto;
34 | max-width: 680px;
35 | padding: 0 15px;
36 | }
37 | .container .credit {
38 | margin: 20px 0;
39 | }
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/signin/signin.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 40px;
3 | padding-bottom: 40px;
4 | background-color: #eee;
5 | }
6 |
7 | .form-signin {
8 | max-width: 330px;
9 | padding: 15px;
10 | margin: 0 auto;
11 | }
12 | .form-signin .form-signin-heading,
13 | .form-signin .checkbox {
14 | margin-bottom: 10px;
15 | }
16 | .form-signin .checkbox {
17 | font-weight: normal;
18 | }
19 | .form-signin .form-control {
20 | position: relative;
21 | font-size: 16px;
22 | height: auto;
23 | padding: 10px;
24 | -webkit-box-sizing: border-box;
25 | -moz-box-sizing: border-box;
26 | box-sizing: border-box;
27 | }
28 | .form-signin .form-control:focus {
29 | z-index: 2;
30 | }
31 | .form-signin input[type="text"] {
32 | margin-bottom: -1px;
33 | border-bottom-left-radius: 0;
34 | border-bottom-right-radius: 0;
35 | }
36 | .form-signin input[type="password"] {
37 | margin-bottom: 10px;
38 | border-top-left-radius: 0;
39 | border-top-right-radius: 0;
40 | }
--------------------------------------------------------------------------------
/src/loader.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var path = require('path');
4 | var Obj = require('./object');
5 | var lib = require('./lib');
6 |
7 | var Loader = Obj.extend({
8 | on: function(name, func) {
9 | this.listeners = this.listeners || {};
10 | this.listeners[name] = this.listeners[name] || [];
11 | this.listeners[name].push(func);
12 | },
13 |
14 | emit: function(name /*, arg1, arg2, ...*/) {
15 | var args = Array.prototype.slice.call(arguments, 1);
16 |
17 | if(this.listeners && this.listeners[name]) {
18 | lib.each(this.listeners[name], function(listener) {
19 | listener.apply(null, args);
20 | });
21 | }
22 | },
23 |
24 | resolve: function(from, to) {
25 | return path.resolve(path.dirname(from), to);
26 | },
27 |
28 | isRelative: function(filename) {
29 | return (filename.indexOf('./') === 0 || filename.indexOf('../') === 0);
30 | }
31 | });
32 |
33 | module.exports = Loader;
34 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_includes/social-buttons.html:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/docs/bower_components/jquery/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "components/jquery",
3 | "description": "jQuery JavaScript Library",
4 | "type": "component",
5 | "homepage": "http://jquery.com",
6 | "license": "MIT",
7 | "support": {
8 | "irc": "irc://irc.freenode.org/jquery",
9 | "issues": "http://bugs.jquery.com",
10 | "forum": "http://forum.jquery.com",
11 | "wiki": "http://docs.jquery.com/",
12 | "source": "https://github.com/jquery/jquery"
13 | },
14 | "authors": [
15 | {
16 | "name": "John Resig",
17 | "email": "jeresig@gmail.com"
18 | }
19 | ],
20 | "require": {
21 | "robloach/component-installer": "*"
22 | },
23 | "extra": {
24 | "component": {
25 | "scripts": [
26 | "jquery.js"
27 | ],
28 | "files": [
29 | "jquery.min.js",
30 | "jquery-migrate.js",
31 | "jquery-migrate.min.js"
32 | ]
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_config.yml:
--------------------------------------------------------------------------------
1 | # Dependencies
2 | markdown: rdiscount
3 | pygments: true
4 |
5 | # Permalinks
6 | permalink: pretty
7 |
8 | # Server
9 | destination: ./_gh_pages
10 | exclude: [".editorconfig", ".gitignore", ".ruby-version", "bower.json", "composer.json", "CONTRIBUTING.md", "CNAME", "LICENSE", "Gruntfile.js", "package.json", "node_modules", "README.md", "less"]
11 | port: 9001
12 |
13 | # Custom vars
14 | repo: https://github.com/twbs/bootstrap
15 | download: https://github.com/twbs/bootstrap/archive/v3.0.0.zip
16 | download_dist: https://github.com/twbs/bootstrap/releases/download/v3.0.0/bootstrap-3.0.0-dist.zip
17 |
18 | blog: http://blog.getbootstrap.com
19 | expo: http://expo.getbootstrap.com
20 |
21 | cdn_css: //netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css
22 | cdn_theme_css: //netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css
23 | cdn_js: //netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js
24 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/jumbotron.less:
--------------------------------------------------------------------------------
1 | //
2 | // Jumbotron
3 | // --------------------------------------------------
4 |
5 |
6 | .jumbotron {
7 | padding: @jumbotron-padding;
8 | margin-bottom: @jumbotron-padding;
9 | font-size: (@font-size-base * 1.5);
10 | font-weight: 200;
11 | line-height: (@line-height-base * 1.5);
12 | color: @jumbotron-color;
13 | background-color: @jumbotron-bg;
14 |
15 | h1 {
16 | line-height: 1;
17 | color: @jumbotron-heading-color;
18 | }
19 | p {
20 | line-height: 1.4;
21 | }
22 |
23 | .container & {
24 | border-radius: @border-radius-large; // Only round corners at higher resolutions if contained in a container
25 | }
26 |
27 | @media screen and (min-width: @screen-tablet) {
28 | padding-top: (@jumbotron-padding * 1.6);
29 | padding-bottom: (@jumbotron-padding * 1.6);
30 |
31 | .container & {
32 | padding-left: (@jumbotron-padding * 2);
33 | padding-right: (@jumbotron-padding * 2);
34 | }
35 |
36 | h1 {
37 | font-size: (@font-size-base * 4.5);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/docs/_plugins/page_toc.rb:
--------------------------------------------------------------------------------
1 | require 'redcarpet';
2 |
3 | module Jekyll
4 | class PageTocTag < Liquid::Tag
5 | def initialize(tag_name, args, tokens)
6 | end
7 | def render(context)
8 | content = File.open(context.environments.first["page"]["path"]).read
9 | content = content.gsub(/^---.*\n---/m, '')
10 | content = content.gsub(/^{% api %}\n([^\n]*)/m, '### \1')
11 | names = {}
12 |
13 | content = Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC).render(content)
14 | content.gsub(/toc_\d*">([^<]*)/) {
15 | name = $1
16 | slug = name.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
17 |
18 | if names.has_key?(slug)
19 | i = 1
20 | newSlug = slug + i.to_s
21 | while names.has_key?(newSlug)
22 | i = i + 1
23 | newSlug = slug + i.to_s
24 | end
25 | slug = newSlug
26 | end
27 |
28 | names[slug] = true
29 | slug + '">' + name
30 | }
31 | end
32 | end
33 |
34 | end
35 |
36 | Liquid::Template.register_tag('page_toc', Jekyll::PageTocTag)
37 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/offcanvas/offcanvas.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Style twaks
3 | * --------------------------------------------------
4 | */
5 | body {
6 | padding-top: 70px;
7 | }
8 | footer {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /*
14 | * Off Canvas
15 | * --------------------------------------------------
16 | */
17 | @media screen and (max-width: 768px) {
18 | .row-offcanvas {
19 | position: relative;
20 | -webkit-transition: all 0.25s ease-out;
21 | -moz-transition: all 0.25s ease-out;
22 | transition: all 0.25s ease-out;
23 | }
24 |
25 | .row-offcanvas-right
26 | .sidebar-offcanvas {
27 | right: -50%; /* 6 columns */
28 | }
29 |
30 | .row-offcanvas-left
31 | .sidebar-offcanvas {
32 | left: -50%; /* 6 columns */
33 | }
34 |
35 | .row-offcanvas-right.active {
36 | right: 50%; /* 6 columns */
37 | }
38 |
39 | .row-offcanvas-left.active {
40 | left: 50%; /* 6 columns */
41 | }
42 |
43 | .sidebar-offcanvas {
44 | position: absolute;
45 | top: 0;
46 | width: 50%; /* 6 columns */
47 | }
48 | }
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/sticky-footer-navbar/sticky-footer-navbar.css:
--------------------------------------------------------------------------------
1 | /* Sticky footer styles
2 | -------------------------------------------------- */
3 |
4 | html,
5 | body {
6 | height: 100%;
7 | /* The html and body elements cannot have any padding or margin. */
8 | }
9 |
10 | /* Wrapper for page content to push down footer */
11 | #wrap {
12 | min-height: 100%;
13 | height: auto !important;
14 | height: 100%;
15 | /* Negative indent footer by its height */
16 | margin: 0 auto -60px;
17 | /* Pad bottom by footer height */
18 | padding: 0 0 60px;
19 | }
20 |
21 | /* Set the fixed height of the footer here */
22 | #footer {
23 | height: 60px;
24 | background-color: #f5f5f5;
25 | }
26 |
27 |
28 | /* Custom page CSS
29 | -------------------------------------------------- */
30 | /* Not required for template or sticky footer method. */
31 |
32 | #wrap > .container {
33 | padding: 60px 15px 0;
34 | }
35 | .container .credit {
36 | margin: 20px 0;
37 | }
38 |
39 | #footer > .container {
40 | padding-left: 15px;
41 | padding-right: 15px;
42 | }
43 |
44 | code {
45 | font-size: 80%;
46 | }
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/media.less:
--------------------------------------------------------------------------------
1 | // Media objects
2 | // Source: http://stubbornella.org/content/?p=497
3 | // --------------------------------------------------
4 |
5 |
6 | // Common styles
7 | // -------------------------
8 |
9 | // Clear the floats
10 | .media,
11 | .media-body {
12 | overflow: hidden;
13 | zoom: 1;
14 | }
15 |
16 | // Proper spacing between instances of .media
17 | .media,
18 | .media .media {
19 | margin-top: 15px;
20 | }
21 | .media:first-child {
22 | margin-top: 0;
23 | }
24 |
25 | // For images and videos, set to block
26 | .media-object {
27 | display: block;
28 | }
29 |
30 | // Reset margins on headings for tighter default spacing
31 | .media-heading {
32 | margin: 0 0 5px;
33 | }
34 |
35 |
36 | // Media image alignment
37 | // -------------------------
38 |
39 | .media {
40 | > .pull-left {
41 | margin-right: 10px;
42 | }
43 | > .pull-right {
44 | margin-left: 10px;
45 | }
46 | }
47 |
48 |
49 | // Media list variation
50 | // -------------------------
51 |
52 | // Undo default ul/ol styles
53 | .media-list {
54 | padding-left: 0;
55 | list-style: none;
56 | }
57 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/pager.less:
--------------------------------------------------------------------------------
1 | //
2 | // Pager pagination
3 | // --------------------------------------------------
4 |
5 |
6 | .pager {
7 | padding-left: 0;
8 | margin: @line-height-computed 0;
9 | list-style: none;
10 | text-align: center;
11 | .clearfix();
12 | li {
13 | display: inline;
14 | > a,
15 | > span {
16 | display: inline-block;
17 | padding: 5px 14px;
18 | background-color: @pagination-bg;
19 | border: 1px solid @pagination-border;
20 | border-radius: @pager-border-radius;
21 | }
22 |
23 | > a:hover,
24 | > a:focus {
25 | text-decoration: none;
26 | background-color: @pagination-hover-bg;
27 | }
28 | }
29 |
30 | .next {
31 | > a,
32 | > span {
33 | float: right;
34 | }
35 | }
36 |
37 | .previous {
38 | > a,
39 | > span {
40 | float: left;
41 | }
42 | }
43 |
44 | .disabled {
45 | > a,
46 | > a:hover,
47 | > a:focus,
48 | > span {
49 | color: @pager-disabled-color;
50 | background-color: @pagination-bg;
51 | cursor: not-allowed;
52 | }
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap"
3 | , "description": "Sleek, intuitive, and powerful front-end framework for faster and easier web development."
4 | , "version": "3.0.0"
5 | , "keywords": ["bootstrap", "css"]
6 | , "homepage": "http://twbs.github.com/bootstrap/"
7 | , "author": "Twitter Inc."
8 | , "scripts": { "test": "grunt test" }
9 | , "repository": {
10 | "type": "git"
11 | , "url": "https://github.com/twbs/bootstrap.git"
12 | }
13 | , "licenses": [
14 | {
15 | "type": "Apache-2.0"
16 | , "url": "http://www.apache.org/licenses/LICENSE-2.0"
17 | }
18 | ]
19 | , "devDependencies": {
20 | "grunt": "~0.4.1"
21 | , "grunt-contrib-clean": "~0.5.0"
22 | , "grunt-contrib-connect": "~0.3.0"
23 | , "grunt-contrib-concat": "~0.3.0"
24 | , "grunt-contrib-copy": "~0.4.0"
25 | , "grunt-contrib-jshint": "~0.6.0"
26 | , "grunt-contrib-uglify": "~0.2.2"
27 | , "grunt-contrib-qunit": "~0.2.2"
28 | , "grunt-contrib-watch": "~0.5.1"
29 | , "grunt-html-validation": "git://github.com/praveenvijayan/grunt-html-validation.git"
30 | , "grunt-jekyll": "~0.3.8"
31 | , "grunt-recess": "~0.3.3"
32 | , "browserstack-runner": "~0.0.11"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/badges.less:
--------------------------------------------------------------------------------
1 | //
2 | // Badges
3 | // --------------------------------------------------
4 |
5 |
6 | // Base classes
7 | .badge {
8 | display: inline-block;
9 | min-width: 10px;
10 | padding: 3px 7px;
11 | font-size: @font-size-small;
12 | font-weight: @badge-font-weight;
13 | color: @badge-color;
14 | line-height: @badge-line-height;
15 | vertical-align: baseline;
16 | white-space: nowrap;
17 | text-align: center;
18 | background-color: @badge-bg;
19 | border-radius: @badge-border-radius;
20 |
21 | // Empty badges collapse automatically (not available in IE8)
22 | &:empty {
23 | display: none;
24 | }
25 | }
26 |
27 | // Hover state, but only for links
28 | a.badge {
29 | &:hover,
30 | &:focus {
31 | color: @badge-link-hover-color;
32 | text-decoration: none;
33 | cursor: pointer;
34 | }
35 | }
36 |
37 | // Quick fix for labels/badges in buttons
38 | .btn .badge {
39 | position: relative;
40 | top: -1px;
41 | }
42 |
43 | // Account for counters in navs
44 | a.list-group-item.active > .badge,
45 | .nav-pills > .active > a > .badge {
46 | color: @badge-active-color;
47 | background-color: @badge-active-bg;
48 | }
49 | .nav-pills > li > a > .badge {
50 | margin-left: 3px;
51 | }
52 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/labels.less:
--------------------------------------------------------------------------------
1 | //
2 | // Labels
3 | // --------------------------------------------------
4 |
5 | .label {
6 | display: inline;
7 | padding: .2em .6em .3em;
8 | font-size: 75%;
9 | font-weight: bold;
10 | line-height: 1;
11 | color: @label-color;
12 | text-align: center;
13 | white-space: nowrap;
14 | vertical-align: baseline;
15 | border-radius: .25em;
16 |
17 | // Add hover effects, but only for links
18 | &[href] {
19 | &:hover,
20 | &:focus {
21 | color: @label-link-hover-color;
22 | text-decoration: none;
23 | cursor: pointer;
24 | }
25 | }
26 |
27 | // Empty labels collapse automatically (not available in IE8)
28 | &:empty {
29 | display: none;
30 | }
31 | }
32 |
33 | // Colors
34 | // Contextual variations (linked labels get darker on :hover)
35 |
36 | .label-default {
37 | .label-variant(@label-default-bg);
38 | }
39 |
40 | .label-primary {
41 | .label-variant(@label-primary-bg);
42 | }
43 |
44 | .label-success {
45 | .label-variant(@label-success-bg);
46 | }
47 |
48 | .label-info {
49 | .label-variant(@label-info-bg);
50 | }
51 |
52 | .label-warning {
53 | .label-variant(@label-warning-bg);
54 | }
55 |
56 | .label-danger {
57 | .label-variant(@label-danger-bg);
58 | }
59 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Contributing
2 | ============
3 |
4 | Thanks for your interest in contributing! The advice below will help you get
5 | your issue fixed / pull request merged.
6 |
7 | Please file bugs and send pull requests to the
8 | [GitHub repository](https://github.com/mozilla/nunjucks/) and
9 | [issue tracker](https://github.com/mozilla/nunjucks/issues).
10 |
11 |
12 | Submitting Issues
13 | -----------------
14 |
15 | Issues are easier to reproduce/resolve when they have:
16 |
17 | - A pull request with a failing test demonstrating the issue
18 | - A code example that produces the issue consistently
19 | - A traceback (when applicable)
20 |
21 |
22 | Pull Requests
23 | -------------
24 |
25 | When creating a pull request:
26 |
27 | - Write tests (see below).
28 | - Note user-facing changes in the `CHANGELOG.md` file.
29 | - Update the documentation (in `docs/`) as needed.
30 |
31 |
32 | Testing
33 | -------
34 |
35 | Please add tests for any changes you submit. The tests should fail before your
36 | code changes, and pass with your changes. Existing tests should not break. Test
37 | coverage (output at the end of every test run) should never decrease after your
38 | changes.
39 |
40 | To install all the requirements for running the tests:
41 |
42 | npm install
43 |
44 | To run the tests:
45 |
46 | npm test
47 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@apostrophecms/nunjucks",
3 | "access": "public",
4 | "description": "2.x maintenance fork of Nunjucks templating language",
5 | "version": "2.5.4",
6 | "author": "P'unk Avenue LLC (maintenance only, original author James Long)",
7 | "dependencies": {
8 | "asap": "^2.0.3",
9 | "yargs": "^3.32.0"
10 | },
11 | "browser": "./browser/nunjucks.js",
12 | "devDependencies": {
13 | "expect.js": "*",
14 | "express": "4.x",
15 | "istanbul": "0.3.x",
16 | "jshint": "2.8.x",
17 | "mocha": "*",
18 | "node-libs-browser": "^0.4.3",
19 | "supertest": "*",
20 | "uglify-js": "*",
21 | "webpack": "^1.8.11"
22 | },
23 | "engines": {
24 | "node": "*"
25 | },
26 | "scripts": {
27 | "lint": "jshint .",
28 | "test": "jshint . && istanbul cover ./node_modules/mocha/bin/_mocha -- -b -R tap tests",
29 | "browserfiles": "./bin/bundle"
30 | },
31 | "bin": {
32 | "nunjucks-precompile": "./bin/precompile"
33 | },
34 | "main": "index",
35 | "repository": {
36 | "type": "git",
37 | "url": "https://github.com/mozilla/nunjucks.git"
38 | },
39 | "keywords": [
40 | "template",
41 | "templating"
42 | ],
43 | "license": "BSD-2-Clause",
44 | "bugs": {
45 | "url": "https://github.com/mozilla/nunjucks/issues"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/tests/express/express.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var path = require('path');
4 | var express = require('express');
5 | var expect = require('expect.js');
6 | var request = require('supertest');
7 | var nunjucks = require('../../');
8 |
9 | var VIEWS = path.join(__dirname, '..', 'express-sample', 'views');
10 |
11 | describe('express', function() {
12 |
13 | var app;
14 | var env;
15 |
16 | beforeEach(function() {
17 | app = express();
18 | env = new nunjucks.Environment(new nunjucks.FileSystemLoader(VIEWS));
19 | env.express(app);
20 | });
21 |
22 | it('should have reference to nunjucks env', function() {
23 | expect(app.settings.nunjucksEnv).to.be(env);
24 | });
25 |
26 | it('should render a view with extension', function(done) {
27 | app.get('/', function(req, res) { res.render('about.njk'); });
28 | request(app)
29 | .get('/')
30 | .expect(/This is just the about page/)
31 | .end(done);
32 | });
33 |
34 | it('should render a view without extension', function(done) {
35 | app.get('/', function(req, res) { res.render('about'); });
36 | app.set('view engine', 'html');
37 | request(app)
38 | .get('/')
39 | .expect(/This is just the about page/)
40 | .end(done);
41 | });
42 | });
43 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_includes/nav-getting-started.html:
--------------------------------------------------------------------------------
1 |
2 | Download Bootstrap
3 |
8 |
9 |
10 | What's included
11 |
12 |
13 | Basic template
14 |
15 |
16 | Examples
17 |
18 |
19 | Disabling responsiveness
20 |
21 |
22 | Migrating from 2.x to 3.0
23 |
29 |
30 |
31 | Browser support
32 |
33 |
34 | Third party support
35 |
36 |
37 | Accessibility
38 |
39 |
40 | License FAQs
41 |
42 |
43 | Customizing Bootstrap
44 |
45 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/tests/unit/scrollspy.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 |
3 | module("scrollspy")
4 |
5 | test("should provide no conflict", function () {
6 | var scrollspy = $.fn.scrollspy.noConflict()
7 | ok(!$.fn.scrollspy, 'scrollspy was set back to undefined (org value)')
8 | $.fn.scrollspy = scrollspy
9 | })
10 |
11 | test("should be defined on jquery object", function () {
12 | ok($(document.body).scrollspy, 'scrollspy method is defined')
13 | })
14 |
15 | test("should return element", function () {
16 | ok($(document.body).scrollspy()[0] == document.body, 'document.body returned')
17 | })
18 |
19 | test("should switch active class on scroll", function () {
20 | var sectionHTML = '
'
21 | , $section = $(sectionHTML).append('#qunit-fixture')
22 | , topbarHTML =''
23 | + '
'
24 | + '
'
25 | + '
'
26 | + '
'
29 | + '
'
30 | + '
'
31 | + '
'
32 | , $topbar = $(topbarHTML).scrollspy()
33 |
34 | ok($topbar.find('.active', true))
35 | })
36 |
37 | })
38 |
--------------------------------------------------------------------------------
/docs/_plugins/api.rb:
--------------------------------------------------------------------------------
1 | require 'redcarpet';
2 | require 'pygments';
3 |
4 | module Jekyll
5 | class ApiTag < Liquid::Block
6 | @@renderer = Class.new(Redcarpet::Render::HTML) do
7 | def add_code_tags(code, lang)
8 | code = code.sub(//, "")
9 | code = code.sub(/<\/pre>/," ")
10 | end
11 |
12 | def block_code(code, lang)
13 | require 'pygments'
14 | lang = lang && lang.split.first || "text"
15 | output = add_code_tags(Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
16 | lang) + "\n"
17 | end
18 | end
19 |
20 | def render(context)
21 | content = @nodelist.map { |token|
22 | token.respond_to?(:render) ? token.render(context) : token
23 | }.join.strip!
24 |
25 | content = content.split(/\n/)
26 | name = content[0]
27 | sig = content[1]
28 | desc = content[2..-1].join("\n")
29 | desc = Redcarpet::Markdown.new(@@renderer.new,
30 | fenced_code_blocks: true).render(desc)
31 |
32 | '### ' + name + "\n\n" + sig + "
\n" +
33 | "" + desc + "
\n"
34 | end
35 | end
36 | end
37 |
38 | Liquid::Template.register_tag('api', Jekyll::ApiTag)
39 |
--------------------------------------------------------------------------------
/bench/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Start
7 | Stop
8 |
9 |
10 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/code.less:
--------------------------------------------------------------------------------
1 | //
2 | // Code (inline and blocK)
3 | // --------------------------------------------------
4 |
5 |
6 | // Inline and block code styles
7 | code,
8 | pre {
9 | font-family: @font-family-monospace;
10 | }
11 |
12 | // Inline code
13 | code {
14 | padding: 2px 4px;
15 | font-size: 90%;
16 | color: @code-color;
17 | background-color: @code-bg;
18 | white-space: nowrap;
19 | border-radius: @border-radius-base;
20 | }
21 |
22 | // Blocks of code
23 | pre {
24 | display: block;
25 | padding: ((@line-height-computed - 1) / 2);
26 | margin: 0 0 (@line-height-computed / 2);
27 | font-size: (@font-size-base - 1); // 14px to 13px
28 | line-height: @line-height-base;
29 | word-break: break-all;
30 | word-wrap: break-word;
31 | color: @pre-color;
32 | background-color: @pre-bg;
33 | border: 1px solid @pre-border-color;
34 | border-radius: @border-radius-base;
35 |
36 | // Make prettyprint styles more spaced out for readability
37 | &.prettyprint {
38 | margin-bottom: @line-height-computed;
39 | }
40 |
41 | // Account for some code outputs that place code tags in pre tags
42 | code {
43 | padding: 0;
44 | font-size: inherit;
45 | color: inherit;
46 | white-space: pre-wrap;
47 | background-color: transparent;
48 | border: 0;
49 | }
50 | }
51 |
52 | // Enable scrollable blocks of code
53 | .pre-scrollable {
54 | max-height: @pre-scrollable-max-height;
55 | overflow-y: scroll;
56 | }
57 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_includes/footer.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | {% if page.slug == "customize" %}
13 |
14 |
15 |
16 |
17 |
18 |
19 | {% endif %}
20 |
21 |
23 |
35 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_includes/nav-main.html:
--------------------------------------------------------------------------------
1 |
33 |
--------------------------------------------------------------------------------
/docs/faq.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: subpage
3 | title: FAQ
4 | pageid: faq
5 | ---
6 | {% raw %}
7 |
8 | # Questions Asked Frequently Enough
9 |
10 | ## Can I use nunjucks in node and the browser/client-side?
11 |
12 | Yes.
13 |
14 | ## Can I use the same templates between nunjucks and jinja2? What are the differences?
15 |
16 | Kind of. There are enough differences that it might take some work.
17 | The first problem is that nunjucks lets you access native JavaScript
18 | constructs, while [jinja2](http://jinja.pocoo.org/) lets you access
19 | Python. This means that there are minor gotchas like the boolean
20 | literal being `true` in nunjucks but `True` in jinja2, and if you call
21 | native methods on arrays the API will be different.
22 |
23 | However, if you avoid accessing the native language features (like `{{ str.trim() }}`)
24 | and rely solely on filters and pure templating
25 | features, it should be easy to make templates compatible.
26 |
27 | Nunjucks has experimental support for installing APIs into the
28 | templating environment to help with Jinja compatibility. See
29 | [installJinjaCompat](api.html#installjinjacompat).
30 |
31 | Additionally, there are few jinja2 features not implemented in nunjucks:
32 |
33 | * The special `self` variable
34 | * `for` does not support `if not` and `else`
35 | * `if i is divisibleby(3)`-style conditionals
36 | * Named block end tags: `{% endblock content %}`
37 | * Sandboxed mode
38 | * Line statements: `# for item in seq`
39 |
40 | Lastly, any custom Python filters and extensions will have to be written in JavaScript.
41 |
42 | {% endraw %}
43 |
--------------------------------------------------------------------------------
/tests/browser/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Mocha Tests
6 |
7 |
13 |
14 |
15 |
16 | Tests do not indicate performance. They are much slower because a
17 | new environment is created for every single template and is
18 | recompiled from scratch, and you can see there are
19 |
quite
20 | a
21 |
lot
22 | of
23 |
tests .
24 |
25 |
26 |
27 |
28 |
29 |
30 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/bootstrap.less:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.0.0
3 | *
4 | * Copyright 2013 Twitter, Inc
5 | * Licensed under the Apache License v2.0
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Designed and built with all the love in the world by @mdo and @fat.
9 | */
10 |
11 | // Core variables and mixins
12 | @import "variables.less";
13 | @import "mixins.less";
14 |
15 | // Reset
16 | @import "normalize.less";
17 | @import "print.less";
18 |
19 | // Core CSS
20 | @import "scaffolding.less";
21 | @import "type.less";
22 | @import "code.less";
23 | @import "grid.less";
24 | @import "tables.less";
25 | @import "forms.less";
26 | @import "buttons.less";
27 |
28 | // Components
29 | @import "component-animations.less";
30 | @import "glyphicons.less";
31 | @import "dropdowns.less";
32 | @import "button-groups.less";
33 | @import "input-groups.less";
34 | @import "navs.less";
35 | @import "navbar.less";
36 | @import "breadcrumbs.less";
37 | @import "pagination.less";
38 | @import "pager.less";
39 | @import "labels.less";
40 | @import "badges.less";
41 | @import "jumbotron.less";
42 | @import "thumbnails.less";
43 | @import "alerts.less";
44 | @import "progress-bars.less";
45 | @import "media.less";
46 | @import "list-group.less";
47 | @import "panels.less";
48 | @import "wells.less";
49 | @import "close.less";
50 |
51 | // Components w/ JavaScript
52 | @import "modals.less";
53 | @import "tooltip.less";
54 | @import "popovers.less";
55 | @import "carousel.less";
56 |
57 | // Utility classes
58 | @import "utilities.less";
59 | @import "responsive-utilities.less";
60 |
--------------------------------------------------------------------------------
/docs/_plugins/locale.rb:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | module Jekyll
4 | module LocaleFilter
5 |
6 | def locale_buttons(url, baseurl)
7 | if url.start_with?('/cn/')
8 | en_url = File.join(baseurl, url.sub(/^\/cn\//, '/'))
9 | cn_url = File.join(baseurl, url)
10 | fr_url = File.join(baseurl, url.sub(/^\/cn\//, '/fr/'))
11 | 'English ' +
12 | '中文 ' +
13 | 'Français '
14 | else
15 | if url.start_with?('/fr/')
16 | en_url = File.join(baseurl, url.sub(/^\/fr\//, '/'))
17 | cn_url = File.join(baseurl, url.sub(/^\/fr\//, '/cn/'))
18 | fr_url = File.join(baseurl, url)
19 | 'English ' +
20 | '中文 ' +
21 | 'Français '
22 | else
23 | en_url = File.join(baseurl, url)
24 | cn_url = File.join(baseurl, url.sub(/^\//, '/cn/'))
25 | fr_url = File.join(baseurl, url.sub(/^\//, '/fr/'))
26 | 'English ' +
27 | '中文 ' +
28 | 'Français '
29 | end
30 | end
31 | end
32 |
33 | end
34 | end
35 |
36 | Liquid::Template::register_filter(Jekyll::LocaleFilter)
37 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_layouts/home.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {% include header.html %}
6 |
7 |
8 |
9 | Skip navigation
10 |
11 |
12 | {% include nav-main.html %}
13 |
14 |
15 | {{ content }}
16 |
17 |
18 | {% include social-buttons.html %}
19 |
20 |
40 |
41 |
42 |
43 | {% include footer.html %}
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/signin/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Signin Template for Bootstrap
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
38 |
39 |
40 |
41 |
42 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/alerts.less:
--------------------------------------------------------------------------------
1 | //
2 | // Alerts
3 | // --------------------------------------------------
4 |
5 |
6 | // Base styles
7 | // -------------------------
8 |
9 | .alert {
10 | padding: @alert-padding;
11 | margin-bottom: @line-height-computed;
12 | border: 1px solid transparent;
13 | border-radius: @alert-border-radius;
14 |
15 | // Headings for larger alerts
16 | h4 {
17 | margin-top: 0;
18 | // Specified for the h4 to prevent conflicts of changing @headingsColor
19 | color: inherit;
20 | }
21 | // Provide class for links that match alerts
22 | .alert-link {
23 | font-weight: @alert-link-font-weight;
24 | }
25 |
26 | // Improve alignment and spacing of inner content
27 | > p,
28 | > ul {
29 | margin-bottom: 0;
30 | }
31 | > p + p {
32 | margin-top: 5px;
33 | }
34 | }
35 |
36 | // Dismissable alerts
37 | //
38 | // Expand the right padding and account for the close button's positioning.
39 |
40 | .alert-dismissable {
41 | padding-right: (@alert-padding + 20);
42 |
43 | // Adjust close link position
44 | .close {
45 | position: relative;
46 | top: -2px;
47 | right: -21px;
48 | color: inherit;
49 | }
50 | }
51 |
52 | // Alternate styles
53 | //
54 | // Generate contextual modifier classes for colorizing the alert.
55 |
56 | .alert-success {
57 | .alert-variant(@alert-success-bg; @alert-success-border; @alert-success-text);
58 | }
59 | .alert-info {
60 | .alert-variant(@alert-info-bg; @alert-info-border; @alert-info-text);
61 | }
62 | .alert-warning {
63 | .alert-variant(@alert-warning-bg; @alert-warning-border; @alert-warning-text);
64 | }
65 | .alert-danger {
66 | .alert-variant(@alert-danger-bg; @alert-danger-border; @alert-danger-text);
67 | }
68 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Nunjucks 2.x: long term maintenance fork
2 |
3 | This fork of Nunjucks 2.x is maintained by the ApostropheCMS team
4 | as part of long term support for ApostropheCMS 2.x. There will be
5 | no new features or intentional changes in behavior. We recommend
6 | the latest version of the mainstream Nunjucks release for new
7 | projects, and plan to use that in future versions of ApostropheCMS
8 | that require a templating language.
9 |
10 | Our maintenance modifications, if any, are released under the same
11 | license as Nunjucks 2.x.
12 |
13 | # Nunjucks
14 |
15 | [Nunjucks](http://mozilla.github.io/nunjucks/) is a full featured
16 | templating engine for javascript. It is heavily inspired by
17 | [jinja2](http://jinja.pocoo.org/). View the docs
18 | [here](http://mozilla.github.io/nunjucks/).
19 |
20 | ## Installation
21 |
22 | `npm install @apostrophecms/nunjucks`
23 |
24 | (View the [CHANGELOG](https://github.com/mozilla/nunjucks/releases)) through 2.5.2. An additional changelog will be added here as neded for maintenance updates.
25 |
26 | ## Documentation
27 |
28 | See [here](http://mozilla.github.io/nunjucks/). NOTE: this is a legacy version (2.x) and not all 3.x documentation may be relevant.
29 |
30 | ## Browser Support
31 |
32 | Supported in all modern browsers. For IE8 support, use [es5-shim](https://github.com/es-shims/es5-shim).
33 |
34 | ## Tests
35 |
36 | Run the tests with `npm test`.
37 |
38 | Watch `master` branch's tests running at http://mozilla.github.io/nunjucks/files/tests/browser/.
39 |
40 | ## Mailing List
41 |
42 | Join our mailing list and get help with and issues you have:
43 | https://groups.google.com/forum/?fromgroups#!forum/nunjucks
44 |
45 | ## Contributors
46 |
47 | https://github.com/mozilla/nunjucks/graphs/contributors
48 |
--------------------------------------------------------------------------------
/tests/express-sample/js/extensions.js:
--------------------------------------------------------------------------------
1 |
2 | function RemoteExtension() {
3 | this.tags = ['remote'];
4 |
5 | this.parse = function(parser, nodes, lexer) {
6 | // get the tag token
7 | var tok = parser.nextToken();
8 |
9 | // parse the args and move after the block end. passing true
10 | // as the second arg is required if there are no parentheses
11 | var args = parser.parseSignature(null, true);
12 | parser.advanceAfterBlockEnd(tok.value);
13 |
14 | // parse the body and move after block end
15 | var body = parser.parseUntilBlocks('error', 'endtruncate');
16 | var errorBody = null;
17 |
18 | if(parser.skipSymbol('error')) {
19 | parser.skip(lexer.TOKEN_BLOCK_END);
20 | errorBody = parser.parseUntilBlocks('endremote');
21 | }
22 |
23 | parser.advanceAfterBlockEnd();
24 |
25 | return new nodes.CallExtension(this, 'run', args, [body, errorBody]);
26 | };
27 |
28 | this.run = function(context, url, body, errorBody) {
29 | var id = 'el' + Math.floor(Math.random() * 10000);
30 | var ret = new nunjucks.runtime.SafeString('' + body() + '
');
31 | var ajax = new XMLHttpRequest();
32 |
33 | ajax.onreadystatechange = function() {
34 | if(ajax.readyState == 4) {
35 | if(ajax.status == 200) {
36 | document.getElementById(id).innerHTML = ajax.responseText;
37 | }
38 | else {
39 | document.getElementById(id).innerHTML = errorBody();
40 | }
41 | }
42 | };
43 |
44 | ajax.open('GET', url, true);
45 | ajax.send();
46 |
47 | return ret;
48 | };
49 | }
50 |
--------------------------------------------------------------------------------
/docs/fr/faq.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: subpage
3 | title: FAQ
4 | pageid: faq
5 | ---
6 | {% raw %}
7 |
8 | # Questions posées fréquemment
9 |
10 | ## Puis-je utiliser nunjucks dans node et dans le navigateur/côté client ?
11 |
12 | Oui.
13 |
14 | ## Puis-je utiliser les mêmes modèles entre nunjucks et Jinja2? Quelles sont les différences ?
15 |
16 | Il y a suffisamment de différences pour que cela puisse prendre du temps.
17 | Le premier problème est que nunjucks vous permet d'accéder aux constructions natifs de
18 | JavaScript, tandis que [jinja2](http://jinja.pocoo.org/) vous permet d'accéder à celle de
19 | Python. Cela signifie qu'il y a des pièges mineurs comme le booléen littéral
20 | qui est `true` dans nunjucks mais `True` dans jinja2, et si vous appelez des
21 | méthodes natives sur les tableaux, l'API sera différent.
22 |
23 | Toutefois, si vous n'accédez pas aux fonctionnalités natives de language (comme `{{ str.trim() }}`)
24 | et utilisez uniquement les filtres et les caractéristiques de templates
25 | pures, il devrait être facile de faire des templates compatibles.
26 |
27 | Nunjucks a un support expérimental pour l'installation d'API dans l'environnement
28 | de templates pour aider la compatibilité Jinja. Voir
29 | [installJinjaCompat](api.html#installjinjacompat).
30 |
31 | En plus, il y a quelques fonctionnalités de jinja2 qui ne sont pas implémentées dans nunjucks:
32 |
33 | * La variable spéciale `self`
34 | * `for` ne supporte pas `if not` et `else`
35 | * Le style conditionnelle de `if i is divisibleby(3)`
36 | * Le nommage des blocs de fin : `{% endblock content %}`
37 | * Le mode bac à sable (sandbox)
38 | * Les commentaires de lignes : `# for item in seq`
39 |
40 | Enfin, tous les filtres et les extensions de Python personnalisés devront être écrits en JavaScript.
41 |
42 | {% endraw %}
43 |
--------------------------------------------------------------------------------
/tests/precompile.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | 'use strict';
3 |
4 | var expect, precompile, precompileString;
5 |
6 | if(typeof require !== 'undefined') {
7 | expect = require('expect.js');
8 | precompile = require('../src/precompile').precompile;
9 | precompileString = require('../src/precompile').precompileString;
10 | }
11 | else {
12 | expect = window.expect;
13 | precompile = nunjucks.precompile;
14 | precompileString = nunjucks.precompileString;
15 | }
16 |
17 | describe('precompile', function() {
18 | it('should return a string', function() {
19 | expect(precompileString('{{ test }}', { name: 'test.njk' })).to.be.an('string');
20 | });
21 |
22 | describe('templates', function() {
23 | it('should return *NIX path seperators', function() {
24 | var fileName;
25 |
26 | precompile('./tests/templates/item.njk', {
27 | wrapper: function(templates) {
28 | fileName = templates[0].name;
29 | }
30 | });
31 |
32 | expect(fileName).to.equal('./tests/templates/item.njk');
33 | });
34 |
35 | it('should return *NIX path seperators, when name is passed as option', function() {
36 | var fileName;
37 |
38 | precompile('test ', {
39 | name: 'path\\to\\file.j2',
40 | isString: true,
41 | wrapper: function(templates) {
42 | fileName = templates[0].name;
43 | }
44 | });
45 |
46 | expect(fileName).to.equal('path/to/file.j2');
47 | });
48 | });
49 | });
50 | })();
51 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/jumbotron-narrow/jumbotron-narrow.css:
--------------------------------------------------------------------------------
1 | /* Space out content a bit */
2 | body {
3 | padding-top: 20px;
4 | padding-bottom: 20px;
5 | }
6 |
7 | /* Everything but the jumbotron gets side spacing for mobile first views */
8 | .header,
9 | .marketing,
10 | .footer {
11 | padding-left: 15px;
12 | padding-right: 15px;
13 | }
14 |
15 | /* Custom page header */
16 | .header {
17 | border-bottom: 1px solid #e5e5e5;
18 | }
19 | /* Make the masthead heading the same height as the navigation */
20 | .header h3 {
21 | margin-top: 0;
22 | margin-bottom: 0;
23 | line-height: 40px;
24 | padding-bottom: 19px;
25 | }
26 |
27 | /* Custom page footer */
28 | .footer {
29 | padding-top: 19px;
30 | color: #777;
31 | border-top: 1px solid #e5e5e5;
32 | }
33 |
34 | /* Customize container */
35 | @media (min-width: 768px) {
36 | .container {
37 | max-width: 730px;
38 | }
39 | }
40 | .container-narrow > hr {
41 | margin: 30px 0;
42 | }
43 |
44 | /* Main marketing message and sign up button */
45 | .jumbotron {
46 | text-align: center;
47 | border-bottom: 1px solid #e5e5e5;
48 | }
49 | .jumbotron .btn {
50 | font-size: 21px;
51 | padding: 14px 24px;
52 | }
53 |
54 | /* Supporting marketing content */
55 | .marketing {
56 | margin: 40px 0;
57 | }
58 | .marketing p + h4 {
59 | margin-top: 28px;
60 | }
61 |
62 | /* Responsive: Portrait tablets and up */
63 | @media screen and (min-width: 768px) {
64 | /* Remove the padding we set earlier */
65 | .header,
66 | .marketing,
67 | .footer {
68 | padding-left: 0;
69 | padding-right: 0;
70 | }
71 | /* Space out the masthead */
72 | .header {
73 | margin-bottom: 30px;
74 | }
75 | /* Remove the bottom border on the jumbotron for visual effect */
76 | .jumbotron {
77 | border-bottom: 0;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_includes/nav-customize.html:
--------------------------------------------------------------------------------
1 |
2 | LESS components
3 |
4 |
5 | jQuery plugins
6 |
7 |
8 | LESS variables
9 |
37 |
38 |
39 | Download
40 |
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | This fork of Nunjucks 2.x is maintained by the ApostropheCMS team
2 | as part of long term support for ApostropheCMS 2.x. There will be
3 | no new features or intentional changes in behavior. We recommend
4 | the latest version of the mainstream Nunjucks release for new
5 | projects, and plan to use that in future versions of ApostropheCMS
6 | that require a templating language.
7 |
8 | Our maintenance modifications, if any, are released under the same
9 | license as Nunjucks 2.x.
10 |
11 | The original license file follows:
12 |
13 | Copyright (c) 2012-2015, James Long
14 | All rights reserved.
15 |
16 | Redistribution and use in source and binary forms, with or without
17 | modification, are permitted provided that the following conditions are
18 | met:
19 |
20 | Redistributions of source code must retain the above copyright
21 | notice, this list of conditions and the following disclaimer.
22 |
23 | Redistributions in binary form must reproduce the above copyright
24 | notice, this list of conditions and the following disclaimer in
25 | the documentation and/or other materials provided with the
26 | distribution.
27 |
28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/tests/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Bootstrap Plugin Test Suite
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/src/object.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // A simple class system, more documentation to come
4 |
5 | function extend(cls, name, props) {
6 | // This does that same thing as Object.create, but with support for IE8
7 | var F = function() {};
8 | F.prototype = cls.prototype;
9 | var prototype = new F();
10 |
11 | // jshint undef: false
12 | var fnTest = /xyz/.test(function(){ xyz; }) ? /\bparent\b/ : /.*/;
13 | props = props || {};
14 |
15 | for(var k in props) {
16 | var src = props[k];
17 | var parent = prototype[k];
18 |
19 | if(typeof parent === 'function' &&
20 | typeof src === 'function' &&
21 | fnTest.test(src)) {
22 | /*jshint -W083 */
23 | prototype[k] = (function (src, parent) {
24 | return function() {
25 | // Save the current parent method
26 | var tmp = this.parent;
27 |
28 | // Set parent to the previous method, call, and restore
29 | this.parent = parent;
30 | var res = src.apply(this, arguments);
31 | this.parent = tmp;
32 |
33 | return res;
34 | };
35 | })(src, parent);
36 | }
37 | else {
38 | prototype[k] = src;
39 | }
40 | }
41 |
42 | prototype.typename = name;
43 |
44 | var new_cls = function() {
45 | if(prototype.init) {
46 | prototype.init.apply(this, arguments);
47 | }
48 | };
49 |
50 | new_cls.prototype = prototype;
51 | new_cls.prototype.constructor = new_cls;
52 |
53 | new_cls.extend = function(name, props) {
54 | if(typeof name === 'object') {
55 | props = name;
56 | name = 'anonymous';
57 | }
58 | return extend(new_cls, name, props);
59 | };
60 |
61 | return new_cls;
62 | }
63 |
64 | module.exports = extend(Object, 'Object', {});
65 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/sticky-footer/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Sticky Footer Template for Bootstrap
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
35 |
Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS.
36 |
Use the sticky footer with a fixed navbar if need be, too.
37 |
38 |
39 |
40 |
45 |
46 |
47 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/globals.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | function cycler(items) {
4 | var index = -1;
5 |
6 | return {
7 | current: null,
8 | reset: function() {
9 | index = -1;
10 | this.current = null;
11 | },
12 |
13 | next: function() {
14 | index++;
15 | if(index >= items.length) {
16 | index = 0;
17 | }
18 |
19 | this.current = items[index];
20 | return this.current;
21 | },
22 | };
23 |
24 | }
25 |
26 | function joiner(sep) {
27 | sep = sep || ',';
28 | var first = true;
29 |
30 | return function() {
31 | var val = first ? '' : sep;
32 | first = false;
33 | return val;
34 | };
35 | }
36 |
37 | // Making this a function instead so it returns a new object
38 | // each time it's called. That way, if something like an environment
39 | // uses it, they will each have their own copy.
40 | function globals() {
41 | return {
42 | range: function(start, stop, step) {
43 | if(typeof stop === 'undefined') {
44 | stop = start;
45 | start = 0;
46 | step = 1;
47 | }
48 | else if(!step) {
49 | step = 1;
50 | }
51 |
52 | var arr = [];
53 | var i;
54 | if (step > 0) {
55 | for (i=start; istop; i+=step) {
60 | arr.push(i);
61 | }
62 | }
63 | return arr;
64 | },
65 |
66 | // lipsum: function(n, html, min, max) {
67 | // },
68 |
69 | cycler: function() {
70 | return cycler(Array.prototype.slice.call(arguments));
71 | },
72 |
73 | joiner: function(sep) {
74 | return joiner(sep);
75 | }
76 | };
77 | }
78 |
79 | module.exports = globals;
80 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/print.less:
--------------------------------------------------------------------------------
1 | //
2 | // Basic print styles
3 | // --------------------------------------------------
4 | // Source: https://github.com/h5bp/html5-boilerplate/blob/master/css/main.css
5 |
6 | @media print {
7 |
8 | * {
9 | text-shadow: none !important;
10 | color: #000 !important; // Black prints faster: h5bp.com/s
11 | background: transparent !important;
12 | box-shadow: none !important;
13 | }
14 |
15 | a,
16 | a:visited {
17 | text-decoration: underline;
18 | }
19 |
20 | a[href]:after {
21 | content: " (" attr(href) ")";
22 | }
23 |
24 | abbr[title]:after {
25 | content: " (" attr(title) ")";
26 | }
27 |
28 | // Don't show links for images, or javascript/internal links
29 | .ir a:after,
30 | a[href^="javascript:"]:after,
31 | a[href^="#"]:after {
32 | content: "";
33 | }
34 |
35 | pre,
36 | blockquote {
37 | border: 1px solid #999;
38 | page-break-inside: avoid;
39 | }
40 |
41 | thead {
42 | display: table-header-group; // h5bp.com/t
43 | }
44 |
45 | tr,
46 | img {
47 | page-break-inside: avoid;
48 | }
49 |
50 | img {
51 | max-width: 100% !important;
52 | }
53 |
54 | @page {
55 | margin: 2cm .5cm;
56 | }
57 |
58 | p,
59 | h2,
60 | h3 {
61 | orphans: 3;
62 | widows: 3;
63 | }
64 |
65 | h2,
66 | h3 {
67 | page-break-after: avoid;
68 | }
69 |
70 | // Bootstrap components
71 | .navbar {
72 | display: none;
73 | }
74 | .table {
75 | td,
76 | th {
77 | background-color: #fff !important;
78 | }
79 | }
80 | .btn,
81 | .dropup > .btn {
82 | > .caret {
83 | border-top-color: #000 !important;
84 | }
85 | }
86 | .label {
87 | border: 1px solid #000;
88 | }
89 |
90 | .table {
91 | border-collapse: collapse !important;
92 | }
93 | .table-bordered {
94 | th,
95 | td {
96 | border: 1px solid #ddd !important;
97 | }
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_includes/header.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {% if page.title == "Bootstrap" %}
8 | {{ page.title }}
9 | {% else if %}
10 | {{ page.title }} · Bootstrap
11 | {% endif %}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
44 |
--------------------------------------------------------------------------------
/tests/api.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | 'use strict';
3 |
4 | var expect, util, Environment, Loader, templatesPath;
5 | var path = require('path');
6 |
7 | if(typeof require !== 'undefined') {
8 | expect = require('expect.js');
9 | util = require('./util');
10 | Environment = require('../src/environment').Environment;
11 | Loader = require('../src/node-loaders').FileSystemLoader;
12 | templatesPath = 'tests/templates';
13 | }
14 | else {
15 | expect = window.expect;
16 | Environment = nunjucks.Environment;
17 | Loader = nunjucks.WebLoader;
18 | templatesPath = '../templates';
19 | }
20 |
21 | describe('api', function() {
22 | it('should always force compilation of parent template', function() {
23 | var env = new Environment(new Loader(templatesPath));
24 |
25 | var child = env.getTemplate('base-inherit.njk');
26 | expect(child.render()).to.be('Foo*Bar*BazFizzle');
27 | });
28 |
29 | it('should handle correctly relative paths', function() {
30 | var env = new Environment(new Loader(templatesPath));
31 |
32 | var child1 = env.getTemplate('relative/test1.njk');
33 | var child2 = env.getTemplate('relative/test2.njk');
34 |
35 | expect(child1.render()).to.be('FooTest1BazFizzle');
36 | expect(child2.render()).to.be('FooTest2BazFizzle');
37 | });
38 |
39 | it('should handle correctly cache for relative paths', function() {
40 | var env = new Environment(new Loader(templatesPath));
41 |
42 | var test = env.getTemplate('relative/test-cache.njk');
43 |
44 | expect(util.normEOL(test.render())).to.be('Test1\nTest2');
45 | });
46 |
47 | it('should handle correctly relative paths in renderString', function() {
48 | var env = new Environment(new Loader(templatesPath));
49 | expect(env.renderString('{% extends "./relative/test1.njk" %}{% block block1 %}Test3{% endblock %}', {}, {
50 | path: path.resolve(templatesPath, 'string.njk')
51 | })).to.be('FooTest3BazFizzle');
52 | });
53 | });
54 | })();
55 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/pagination.less:
--------------------------------------------------------------------------------
1 | //
2 | // Pagination (multiple pages)
3 | // --------------------------------------------------
4 | .pagination {
5 | display: inline-block;
6 | padding-left: 0;
7 | margin: @line-height-computed 0;
8 | border-radius: @border-radius-base;
9 |
10 | > li {
11 | display: inline; // Remove list-style and block-level defaults
12 | > a,
13 | > span {
14 | position: relative;
15 | float: left; // Collapse white-space
16 | padding: @padding-base-vertical @padding-base-horizontal;
17 | line-height: @line-height-base;
18 | text-decoration: none;
19 | background-color: @pagination-bg;
20 | border: 1px solid @pagination-border;
21 | margin-left: -1px;
22 | }
23 | &:first-child {
24 | > a,
25 | > span {
26 | margin-left: 0;
27 | .border-left-radius(@border-radius-base);
28 | }
29 | }
30 | &:last-child {
31 | > a,
32 | > span {
33 | .border-right-radius(@border-radius-base);
34 | }
35 | }
36 | }
37 |
38 | > li > a,
39 | > li > span {
40 | &:hover,
41 | &:focus {
42 | background-color: @pagination-hover-bg;
43 | }
44 | }
45 |
46 | > .active > a,
47 | > .active > span {
48 | &,
49 | &:hover,
50 | &:focus {
51 | z-index: 2;
52 | color: @pagination-active-color;
53 | background-color: @pagination-active-bg;
54 | border-color: @pagination-active-bg;
55 | cursor: default;
56 | }
57 | }
58 |
59 | > .disabled {
60 | > span,
61 | > a,
62 | > a:hover,
63 | > a:focus {
64 | color: @pagination-disabled-color;
65 | background-color: @pagination-bg;
66 | border-color: @pagination-border;
67 | cursor: not-allowed;
68 | }
69 | }
70 | }
71 |
72 | // Sizing
73 | // --------------------------------------------------
74 |
75 | // Large
76 | .pagination-lg {
77 | .pagination-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @border-radius-large);
78 | }
79 |
80 | // Small
81 | .pagination-sm {
82 | .pagination-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @border-radius-small);
83 | }
84 |
--------------------------------------------------------------------------------
/src/node-loaders.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var fs = require('fs');
4 | var path = require('path');
5 | var lib = require('./lib');
6 | var Loader = require('./loader');
7 | var PrecompiledLoader = require('./precompiled-loader.js');
8 |
9 | // Node <0.7.1 compatibility
10 | var existsSync = fs.existsSync || path.existsSync;
11 |
12 | var FileSystemLoader = Loader.extend({
13 | init: function(searchPaths, opts) {
14 | if(typeof opts === 'boolean') {
15 | console.log(
16 | '[nunjucks] Warning: you passed a boolean as the second ' +
17 | 'argument to FileSystemLoader, but it now takes an options ' +
18 | 'object. See http://mozilla.github.io/nunjucks/api.html#filesystemloader'
19 | );
20 | }
21 |
22 | opts = opts || {};
23 | this.pathsToNames = {};
24 | this.noCache = !!opts.noCache;
25 |
26 | if(searchPaths) {
27 | searchPaths = lib.isArray(searchPaths) ? searchPaths : [searchPaths];
28 | // For windows, convert to forward slashes
29 | this.searchPaths = searchPaths.map(path.normalize);
30 | }
31 | else {
32 | this.searchPaths = ['.'];
33 | }
34 | },
35 |
36 | getSource: function(name) {
37 | var fullpath = null;
38 | var paths = this.searchPaths;
39 |
40 | for(var i=0; i, , or .
8 | .list-group {
9 | // No need to set list-style: none; since .list-group-item is block level
10 | margin-bottom: 20px;
11 | padding-left: 0; // reset padding because ul and ol
12 | }
13 |
14 | // Individual list items
15 | // -------------------------
16 |
17 | .list-group-item {
18 | position: relative;
19 | display: block;
20 | padding: 10px 15px;
21 | // Place the border on the list items and negative margin up for better styling
22 | margin-bottom: -1px;
23 | background-color: @list-group-bg;
24 | border: 1px solid @list-group-border;
25 |
26 | // Round the first and last items
27 | &:first-child {
28 | .border-top-radius(@list-group-border-radius);
29 | }
30 | &:last-child {
31 | margin-bottom: 0;
32 | .border-bottom-radius(@list-group-border-radius);
33 | }
34 |
35 | // Align badges within list items
36 | > .badge {
37 | float: right;
38 | }
39 | > .badge + .badge {
40 | margin-right: 5px;
41 | }
42 |
43 | // Linked list items
44 | a& {
45 | color: @list-group-link-color;
46 |
47 | .list-group-item-heading {
48 | color: @list-group-link-heading-color;
49 | }
50 |
51 | // Hover state
52 | &:hover,
53 | &:focus {
54 | text-decoration: none;
55 | background-color: @list-group-hover-bg;
56 | }
57 | }
58 |
59 | // Active class on item itself, not parent
60 | &.active,
61 | &.active:hover,
62 | &.active:focus {
63 | z-index: 2; // Place active items above their siblings for proper border styling
64 | color: @list-group-active-color;
65 | background-color: @list-group-active-bg;
66 | border-color: @list-group-active-border;
67 |
68 | // Force color to inherit for custom content
69 | .list-group-item-heading {
70 | color: inherit;
71 | }
72 | .list-group-item-text {
73 | color: lighten(@list-group-active-bg, 40%);
74 | }
75 | }
76 | }
77 |
78 | // Custom content options
79 | // -------------------------
80 |
81 | .list-group-item-heading {
82 | margin-top: 0;
83 | margin-bottom: 5px;
84 | }
85 | .list-group-item-text {
86 | margin-bottom: 0;
87 | line-height: 1.3;
88 | }
89 |
--------------------------------------------------------------------------------
/docs/cn/getting-started.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: subpage
3 | pageid: getting-started
4 | ---
5 |
6 | # 快速上手
7 |
8 | ## Node 端使用
9 |
10 | ```
11 | $ npm install nunjucks
12 | ```
13 |
14 | 下载后可直接 `require('nunjucks')` 使用
15 |
16 | ## 浏览器端使用
17 |
18 | 可直接使用 [nunjucks.js](files/nunjucks.js) ([min](files/nunjucks.min.js)),如果针对编译后的模板可使用 [nunjucks-slim.js](files/nunjucks-slim.js) ([min](files/nunjucks-slim.min.js))。
19 |
20 | ### 你应该使用哪个文件
21 |
22 | * **nunjucks.js** 可用于动态加载模板,当模板变化时重新加载,也可以用于预编译后的模板。包含编译器,所以会比较大 (20K min/gzipped)。如果你刚接触 nunjucks 可使用这个文件,如果你不在意大小也可以在生产环境使用。
23 |
24 | * **nunjucks-slim.js** 只能用于预编译后的模板,只包含运行时的代码,所以比较小 (8K min/gzipped)。一般用于生产环境,如果你使用 [grunt](https://github.com/jlongster/grunt-nunjucks) 或[gulp](https://github.com/sindresorhus/gulp-nunjucks)任务自动预编译,也可以在开发环境使用。
25 |
26 | 直接用 `script` 引入文件:
27 |
28 | ```html
29 |
30 | ```
31 |
32 | 或者可以作为一个 AMD 模块加载:
33 |
34 | ```js
35 | define(['nunjucks'], function(nunjucks) {
36 | });
37 | ```
38 |
39 | > 确保在生产环境使用预编译版本,可使用 [grunt
40 | > ](https://github.com/jlongster/grunt-nunjucks)或[gulp](https://github.com/sindresorhus/gulp-nunjucks),可在 [浏览器使用](api.html#browser-usage) 查看客户端优化的配置。
41 |
42 | ## 使用说明
43 |
44 | 这是最简单使用 nunjucks 的方式,首先设置配置项(如 autoescaping),然后渲染一个字符串:
45 |
46 | ```js
47 | nunjucks.configure({ autoescape: true });
48 | nunjucks.renderString('Hello {% raw %}{{ username }}{% endraw %}', { username: 'James' });
49 | ```
50 |
51 | `renderString` 并不常用,而是使用 `render` 来直接渲染文件,这种方式支持继承(extends)和包含(include)模板。使用之前需要配置文件的路径:
52 |
53 | ```js
54 | nunjucks.configure('views', { autoescape: true });
55 | nunjucks.render('index.html', { foo: 'bar' });
56 | ```
57 |
58 | 在 node 端,`'views'` 为相对于当前工作目录 (working
59 | directory) 的路径。在浏览器端则为一个相对的 url,最好指定为绝对路径 (如 `'/views'`)。
60 |
61 | 如果使用 express 可直接传入 `configure`:
62 |
63 | ```js
64 | var app = express();
65 |
66 | nunjucks.configure('views', {
67 | autoescape: true,
68 | express: app
69 | });
70 |
71 | app.get('/', function(req, res) {
72 | res.render('index.html');
73 | });
74 | ```
75 |
76 | 上面的 API 适用于 node 端和浏览器端 (express 只适用于 node 端),在 node 端 nunjucks 从文件系统加载模板,在浏览器端通过 http 加载模板。
77 |
78 | 如果你在浏览器上使用[编译后](api.html#precompiling)的模板的话,你不需要额外做其他的事情系统也能够理解它们。这使得我们可以轻松地在开发环境和生产环境上使用同一份代码,并在生产环境上只使用已经编译过的模板。
79 |
80 | ## 更多信息
81 |
82 | 这只是冰山一角,可继续查看 [API](api.html) 文档和[模板语言](templating.html)。
83 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/assets/js/html5shiv.js:
--------------------------------------------------------------------------------
1 | /*
2 | HTML5 Shiv v3.6.2pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3 | */
4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x";
6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="
";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",version:"3.6.2pre",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
8 | for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d
×'
22 | + 'Holy guacamole! Best check yo self, you\'re not looking too good.
'
23 | + ' '
24 | , alert = $(alertHTML).alert()
25 |
26 | alert.find('.close').click()
27 |
28 | ok(!alert.hasClass('in'), 'remove .in class on .close click')
29 | })
30 |
31 | test("should remove element when clicking .close", function () {
32 | $.support.transition = false
33 |
34 | var alertHTML = ''
35 | + '
× '
36 | + '
Holy guacamole! Best check yo self, you\'re not looking too good.
'
37 | + '
'
38 | , alert = $(alertHTML).appendTo('#qunit-fixture').alert()
39 |
40 | ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom')
41 |
42 | alert.find('.close').click()
43 |
44 | ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom')
45 | })
46 |
47 | test("should not fire closed when close is prevented", function () {
48 | $.support.transition = false
49 | stop();
50 | $('
')
51 | .on('close.bs.alert', function (e) {
52 | e.preventDefault();
53 | ok(true);
54 | start();
55 | })
56 | .on('closed.bs.alert', function () {
57 | ok(false);
58 | })
59 | .alert('close')
60 | })
61 |
62 | })
63 |
--------------------------------------------------------------------------------
/bin/bundle.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | 'use strict';
3 |
4 | var path = require('path');
5 | var webpack = require('webpack');
6 | var fs = require('fs');
7 |
8 | var VERSION = JSON.parse(fs.readFileSync('./package.json')).version;
9 | var TYPE = '';
10 | var SLIM = false;
11 | var MINIFIED = false;
12 | var TARGET = '';
13 |
14 | var args = process.argv.slice(2);
15 | while(args.length > 0) {
16 | if(args.length === 1) {
17 | TARGET = args[0];
18 | }
19 | else {
20 | switch(args[0]) {
21 | case '-s':
22 | SLIM = true;
23 | TYPE = '(slim, only works with precompiled templates)';
24 | break;
25 | case '-m':
26 | MINIFIED = true;
27 | break;
28 | }
29 | }
30 | args.shift();
31 | }
32 |
33 | var config = {
34 | entry: './index.js',
35 | output: {
36 | path: path.join(__dirname, '../browser'),
37 | filename: TARGET,
38 | library: 'nunjucks',
39 | libraryTarget: 'umd'
40 | },
41 | node: {
42 | process: 'empty'
43 | },
44 | plugins: [
45 | new webpack.NormalModuleReplacementPlugin(/(path|precompile)$/,
46 | 'node-libs-browser/mock/empty'),
47 | new webpack.BannerPlugin(
48 | 'Browser bundle of nunjucks ' + VERSION + ' ' + TYPE
49 | ),
50 | new webpack.DefinePlugin({
51 | 'process.env': {
52 | IS_BROWSER: true
53 | }
54 | })
55 | ]
56 | };
57 |
58 | if(SLIM) {
59 | config.plugins.push(
60 | new webpack.NormalModuleReplacementPlugin(
61 | /(nodes|lexer|parser|transformer|compiler|loaders)$/,
62 | 'node-libs-browser/mock/empty'
63 | )
64 | );
65 | }
66 | else {
67 | config.plugins.push(
68 | new webpack.NormalModuleReplacementPlugin(/loaders\.js$/,
69 | './web-loaders.js')
70 | );
71 | }
72 |
73 | if(MINIFIED) {
74 | config.plugins.push(
75 | new webpack.optimize.UglifyJsPlugin({ sourceMap: false })
76 | );
77 | }
78 |
79 | var outputOptions = {
80 | cached: false,
81 | cachedAssets: false
82 | };
83 |
84 | webpack(config).run(function (err, stats) {
85 | if(err) {
86 | throw new Error(err);
87 | }
88 | console.log(stats.toString(outputOptions));
89 | });
90 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/tests/phantom.js:
--------------------------------------------------------------------------------
1 | // Simple phantom.js integration script
2 | // Adapted from Modernizr
3 |
4 | function waitFor(testFx, onReady, timeOutMillis) {
5 | var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 5001 //< Default Max Timout is 5s
6 | , start = new Date().getTime()
7 | , condition = false
8 | , interval = setInterval(function () {
9 | if ((new Date().getTime() - start < maxtimeOutMillis) && !condition) {
10 | // If not time-out yet and condition not yet fulfilled
11 | condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()) //< defensive code
12 | } else {
13 | if (!condition) {
14 | // If condition still not fulfilled (timeout but condition is 'false')
15 | console.log("'waitFor()' timeout")
16 | phantom.exit(1)
17 | } else {
18 | // Condition fulfilled (timeout and/or condition is 'true')
19 | typeof(onReady) === "string" ? eval(onReady) : onReady() //< Do what it's supposed to do once the condition is fulfilled
20 | clearInterval(interval) //< Stop this interval
21 | }
22 | }
23 | }, 100) //< repeat check every 100ms
24 | }
25 |
26 |
27 | if (phantom.args.length === 0 || phantom.args.length > 2) {
28 | console.log('Usage: phantom.js URL')
29 | phantom.exit()
30 | }
31 |
32 | var page = new WebPage()
33 |
34 | // Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
35 | page.onConsoleMessage = function(msg) {
36 | console.log(msg)
37 | };
38 |
39 | page.open(phantom.args[0], function(status){
40 | if (status !== "success") {
41 | console.log("Unable to access network")
42 | phantom.exit()
43 | } else {
44 | waitFor(function(){
45 | return page.evaluate(function(){
46 | var el = document.getElementById('qunit-testresult')
47 | if (el && el.innerText.match('completed')) {
48 | return true
49 | }
50 | return false
51 | })
52 | }, function(){
53 | var failedNum = page.evaluate(function(){
54 | var el = document.getElementById('qunit-testresult')
55 | try {
56 | return el.getElementsByClassName('failed')[0].innerHTML
57 | } catch (e) { }
58 | return 10000
59 | });
60 | phantom.exit((parseInt(failedNum, 10) > 0) ? 1 : 0)
61 | })
62 | }
63 | })
64 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/tests/unit/phantom.js:
--------------------------------------------------------------------------------
1 | /*
2 | * grunt-contrib-qunit
3 | * http://gruntjs.com/
4 | *
5 | * Copyright (c) 2013 "Cowboy" Ben Alman, contributors
6 | * Licensed under the MIT license.
7 | */
8 |
9 | /*global QUnit:true, alert:true*/
10 | (function () {
11 | 'use strict';
12 |
13 | // Don't re-order tests.
14 | QUnit.config.reorder = false
15 | // Run tests serially, not in parallel.
16 | QUnit.config.autorun = false
17 |
18 | // Send messages to the parent PhantomJS process via alert! Good times!!
19 | function sendMessage() {
20 | var args = [].slice.call(arguments)
21 | alert(JSON.stringify(args))
22 | }
23 |
24 | // These methods connect QUnit to PhantomJS.
25 | QUnit.log = function(obj) {
26 | // What is this I don’t even
27 | if (obj.message === '[object Object], undefined:undefined') { return }
28 | // Parse some stuff before sending it.
29 | var actual = QUnit.jsDump.parse(obj.actual)
30 | var expected = QUnit.jsDump.parse(obj.expected)
31 | // Send it.
32 | sendMessage('qunit.log', obj.result, actual, expected, obj.message, obj.source)
33 | }
34 |
35 | QUnit.testStart = function(obj) {
36 | sendMessage('qunit.testStart', obj.name)
37 | }
38 |
39 | QUnit.testDone = function(obj) {
40 | sendMessage('qunit.testDone', obj.name, obj.failed, obj.passed, obj.total)
41 | }
42 |
43 | QUnit.moduleStart = function(obj) {
44 | sendMessage('qunit.moduleStart', obj.name)
45 | }
46 |
47 | QUnit.begin = function () {
48 | sendMessage('qunit.begin')
49 | console.log("Starting test suite")
50 | console.log("================================================\n")
51 | }
52 |
53 | QUnit.moduleDone = function (opts) {
54 | if (opts.failed === 0) {
55 | console.log("\r\u2714 All tests passed in '" + opts.name + "' module")
56 | } else {
57 | console.log("\u2716 " + opts.failed + " tests failed in '" + opts.name + "' module")
58 | }
59 | sendMessage('qunit.moduleDone', opts.name, opts.failed, opts.passed, opts.total)
60 | }
61 |
62 | QUnit.done = function (opts) {
63 | console.log("\n================================================")
64 | console.log("Tests completed in " + opts.runtime + " milliseconds")
65 | console.log(opts.passed + " tests of " + opts.total + " passed, " + opts.failed + " failed.")
66 | sendMessage('qunit.done', opts.failed, opts.passed, opts.total, opts.runtime)
67 | }
68 |
69 | }())
70 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/starter-template/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Starter Template for Bootstrap
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
27 |
46 |
47 |
48 |
49 |
50 |
Bootstrap starter template
51 |
Use this document as a way to quickly start any new project. All you get is this text and a mostly barebones HTML document.
52 |
53 |
54 |
55 |
56 |
57 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/progress-bars.less:
--------------------------------------------------------------------------------
1 | //
2 | // Progress bars
3 | // --------------------------------------------------
4 |
5 |
6 | // Bar animations
7 | // -------------------------
8 |
9 | // Webkit
10 | @-webkit-keyframes progress-bar-stripes {
11 | from { background-position: 40px 0; }
12 | to { background-position: 0 0; }
13 | }
14 |
15 | // Firefox
16 | @-moz-keyframes progress-bar-stripes {
17 | from { background-position: 40px 0; }
18 | to { background-position: 0 0; }
19 | }
20 |
21 | // Opera
22 | @-o-keyframes progress-bar-stripes {
23 | from { background-position: 0 0; }
24 | to { background-position: 40px 0; }
25 | }
26 |
27 | // Spec and IE10+
28 | @keyframes progress-bar-stripes {
29 | from { background-position: 40px 0; }
30 | to { background-position: 0 0; }
31 | }
32 |
33 |
34 |
35 | // Bar itself
36 | // -------------------------
37 |
38 | // Outer container
39 | .progress {
40 | overflow: hidden;
41 | height: @line-height-computed;
42 | margin-bottom: @line-height-computed;
43 | background-color: @progress-bg;
44 | border-radius: @border-radius-base;
45 | .box-shadow(inset 0 1px 2px rgba(0,0,0,.1));
46 | }
47 |
48 | // Bar of progress
49 | .progress-bar {
50 | float: left;
51 | width: 0%;
52 | height: 100%;
53 | font-size: @font-size-small;
54 | color: @progress-bar-color;
55 | text-align: center;
56 | background-color: @progress-bar-bg;
57 | .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15));
58 | .transition(width .6s ease);
59 | }
60 |
61 | // Striped bars
62 | .progress-striped .progress-bar {
63 | #gradient > .striped(@progress-bar-bg);
64 | background-size: 40px 40px;
65 | }
66 |
67 | // Call animation for the active one
68 | .progress.active .progress-bar {
69 | -webkit-animation: progress-bar-stripes 2s linear infinite;
70 | -moz-animation: progress-bar-stripes 2s linear infinite;
71 | -ms-animation: progress-bar-stripes 2s linear infinite;
72 | -o-animation: progress-bar-stripes 2s linear infinite;
73 | animation: progress-bar-stripes 2s linear infinite;
74 | }
75 |
76 |
77 |
78 | // Variations
79 | // -------------------------
80 |
81 | .progress-bar-success {
82 | .progress-bar-variant(@progress-bar-success-bg);
83 | }
84 |
85 | .progress-bar-info {
86 | .progress-bar-variant(@progress-bar-info-bg);
87 | }
88 |
89 | .progress-bar-warning {
90 | .progress-bar-variant(@progress-bar-warning-bg);
91 | }
92 |
93 | .progress-bar-danger {
94 | .progress-bar-variant(@progress-bar-danger-bg);
95 | }
96 |
--------------------------------------------------------------------------------
/bin/precompile:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | var path = require('path');
3 | var precompile = require('../src/precompile').precompile;
4 | var Environment = require('../src/environment').Environment;
5 | var lib = require('../src/lib');
6 |
7 | var yargs = require('yargs')
8 |
9 | .usage('$0 [-f|--force] [-a|--filters ] [-n|--name ] [-i|--include ] [-x|--exclude ] [-w|--wrapper ] ')
10 | .wrap(80)
11 |
12 | .describe('help', 'Display this help message')
13 | .boolean('help')
14 | .alias('h', 'help')
15 | .alias('?', 'help')
16 |
17 | .describe('force', 'Force compilation to continue on error')
18 | .boolean('force')
19 | .alias('f', 'force')
20 |
21 | .describe('filters', 'Give the compiler a comma-delimited list of asynchronous filters, required for correctly generating code')
22 | .string('filters')
23 | .alias('a', 'filters')
24 |
25 | .describe('name', 'Specify the template name when compiling a single file')
26 | .string('name')
27 | .alias('n', 'n')
28 |
29 | .describe('include', 'Include a file or folder which match the regex but would otherwise be excluded. You can use this flag multiple times')
30 | .string('include' )
31 | .default('include', ['\\.html$', '\\.jinja$'])
32 | .alias('i', 'include')
33 |
34 | .describe('exclude', 'Exclude a file or folder which match the regex but would otherwise be included. You can use this flag multiple times')
35 | .string('exclude' )
36 | .default('exclude', [])
37 | .alias('x', 'exclude')
38 |
39 | .describe('wrapper', 'Load a external plugin to change the output format of the precompiled templates (for example, "-w custom" will load a module named "nunjucks-custom")')
40 | .string('wrapper')
41 | .alias('w', 'wrapper')
42 |
43 | .demand(1);
44 |
45 | var argv = yargs.argv;
46 |
47 | if (argv.help) {
48 | yargs.showHelp();
49 | process.exit(1);
50 | }
51 |
52 | var env = new Environment([]);
53 |
54 | lib.each([].concat(argv.filters).join(',').split(','), function(name) {
55 | env.addFilter(name.trim(), function() {}, true);
56 | });
57 |
58 | if(argv.wrapper) {
59 | argv.wrapper = require('nunjucks-' + argv.wrapper).wrapper;
60 | }
61 |
62 | console.log(precompile(argv._[0], {
63 | env : env,
64 | force : argv.force,
65 | name : argv.name,
66 | wrapper: argv.wrapper,
67 |
68 | include : [].concat(argv.include),
69 | exclude : [].concat(argv.exclude)
70 | }));
71 |
--------------------------------------------------------------------------------
/docs/_layouts/page.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Nunjucks
5 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Nunjucks
17 |
18 |
32 |
33 |
34 | {{ content }}
35 |
36 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/MAINTENANCE.md:
--------------------------------------------------------------------------------
1 |
2 | # Pushing a New Version
3 |
4 | Nunjucks attempts to adhere to semantic versioning. The API is very stable, so
5 | from here on out it will most likely be point releases.
6 |
7 | 1. Do a `pull` from github to make sure you have all the latest updates.
8 |
9 | 2. View all the changes since the last version:
10 |
11 | ```
12 | $ git log --oneline v1.2.3..master
13 | ```
14 |
15 | Replace `v1.2.3` with whatever the last version was, and you'll see all the
16 | changes going out in this version. Ensure that all significant user-facing
17 | changes (new features and bugfixes) are mentioned in `CHANGELOG.md`. Change the
18 | "master (unreleased)" heading in `CHANGELOG.md` to the new version number and
19 | date.
20 |
21 | 3. Update the version in `package.json`.
22 |
23 | 3. Run the command to update the ready-made files for the browser.
24 |
25 | ```
26 | $ npm run browserfiles
27 | ```
28 |
29 | 5. Commit above changes and push to `master` (or a release branch, if using one).
30 |
31 | 6. Draft a new release on GitHub and copy the changelog to the description. The
32 | tag and title should both be the version, in the form `v2.3.0`. Publish the
33 | release.
34 |
35 | 7. Publish to npm:
36 |
37 | ```
38 | npm publish
39 | ```
40 |
41 | 8. Make sure docs are up-to-date. You need to copy all the `nunjucks*.js` files
42 | in `browser/` to the docs. This is where the "download" link points to in
43 | the docs. You also need to copy the tests into the docs, for the online
44 | browser tests. ``make prod`` in the ``docs/`` dir will handle these tasks
45 | for you. Push (force push if necessary) the build out _site folder onto the
46 | `gh-pages` branch of the `nunjucks` repo to get it live. One way to do that
47 | is the following commands. These commands presume that you have another
48 | nunjucks git clone inside the (git-ignored) `docs/_site` directory, checked
49 | out to the `gh-pages` branch (and tracking `origin/gh-pages`). (To set that
50 | up the first time, `cd docs/_site`, `rm -rf *`, `git clone
51 | git@github.com:mozilla/nunjucks.git .`, and `git checkout gh-pages`).
52 |
53 | ```
54 | cd docs && make prod
55 | cd files
56 | python -m SimpleHTTPServer
57 | # load http://localhost:8000/tests/browser/ and verify tests pass in browser
58 | cd ../_site && git add -A && git commit && git push
59 | ```
60 |
61 | 9. Add a new "master (unreleased)" section at the top of `CHANGELOG.md`.
62 |
63 | 10. Bump the version number in `package.json` to a development pre-release of
64 | the next anticipated release number (e.g. "2.2.0-dev.1").
65 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var lib = require('./src/lib');
4 | var env = require('./src/environment');
5 | var Loader = require('./src/loader');
6 | var loaders = require('./src/loaders');
7 | var precompile = require('./src/precompile');
8 |
9 | module.exports = {};
10 | module.exports.Environment = env.Environment;
11 | module.exports.Template = env.Template;
12 |
13 | module.exports.Loader = Loader;
14 | module.exports.FileSystemLoader = loaders.FileSystemLoader;
15 | module.exports.PrecompiledLoader = loaders.PrecompiledLoader;
16 | module.exports.WebLoader = loaders.WebLoader;
17 |
18 | module.exports.compiler = require('./src/compiler');
19 | module.exports.parser = require('./src/parser');
20 | module.exports.lexer = require('./src/lexer');
21 | module.exports.runtime = require('./src/runtime');
22 | module.exports.lib = lib;
23 | module.exports.nodes = require('./src/nodes');
24 |
25 | module.exports.installJinjaCompat = require('./src/jinja-compat.js');
26 |
27 | // A single instance of an environment, since this is so commonly used
28 |
29 | var e;
30 | module.exports.configure = function(templatesPath, opts) {
31 | opts = opts || {};
32 | if(lib.isObject(templatesPath)) {
33 | opts = templatesPath;
34 | templatesPath = null;
35 | }
36 |
37 | var TemplateLoader;
38 | if(loaders.FileSystemLoader) {
39 | TemplateLoader = new loaders.FileSystemLoader(templatesPath, {
40 | watch: opts.watch,
41 | noCache: opts.noCache
42 | });
43 | }
44 | else if(loaders.WebLoader) {
45 | TemplateLoader = new loaders.WebLoader(templatesPath, {
46 | useCache: opts.web && opts.web.useCache,
47 | async: opts.web && opts.web.async
48 | });
49 | }
50 |
51 | e = new env.Environment(TemplateLoader, opts);
52 |
53 | if(opts && opts.express) {
54 | e.express(opts.express);
55 | }
56 |
57 | return e;
58 | };
59 |
60 | module.exports.compile = function(src, env, path, eagerCompile) {
61 | if(!e) {
62 | module.exports.configure();
63 | }
64 | return new module.exports.Template(src, env, path, eagerCompile);
65 | };
66 |
67 | module.exports.render = function(name, ctx, cb) {
68 | if(!e) {
69 | module.exports.configure();
70 | }
71 |
72 | return e.render(name, ctx, cb);
73 | };
74 |
75 | module.exports.renderString = function(src, ctx, cb) {
76 | if(!e) {
77 | module.exports.configure();
78 | }
79 |
80 | return e.renderString(src, ctx, cb);
81 | };
82 |
83 | if(precompile) {
84 | module.exports.precompile = precompile.precompile;
85 | module.exports.precompileString = precompile.precompileString;
86 | }
87 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_includes/nav-javascript.html:
--------------------------------------------------------------------------------
1 |
2 | Overview
3 |
10 |
11 | Transitions
12 |
13 | Modal
14 |
18 |
19 |
20 | Dropdown
21 |
25 |
26 |
27 | Scrollspy
28 |
32 |
33 |
34 | Tab
35 |
39 |
40 |
41 | Tooltip
42 |
46 |
47 |
48 | Popover
49 |
53 |
54 |
55 | Alert
56 |
60 |
61 |
62 | Button
63 |
67 |
68 |
69 | Collapse
70 |
74 |
75 |
76 | Carousel
77 |
81 |
82 |
83 | Affix
84 |
88 |
89 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/scaffolding.less:
--------------------------------------------------------------------------------
1 | //
2 | // Scaffolding
3 | // --------------------------------------------------
4 |
5 |
6 | // Reset the box-sizing
7 |
8 | *,
9 | *:before,
10 | *:after {
11 | .box-sizing(border-box);
12 | }
13 |
14 |
15 | // Body reset
16 |
17 | html {
18 | font-size: 62.5%;
19 | -webkit-tap-highlight-color: rgba(0,0,0,0);
20 | }
21 |
22 | body {
23 | font-family: @font-family-base;
24 | font-size: @font-size-base;
25 | line-height: @line-height-base;
26 | color: @text-color;
27 | background-color: @body-bg;
28 | }
29 |
30 | // Reset fonts for relevant elements
31 | input,
32 | button,
33 | select,
34 | textarea {
35 | font-family: inherit;
36 | font-size: inherit;
37 | line-height: inherit;
38 | }
39 |
40 | // Reset unusual Firefox-on-Android default style.
41 | //
42 | // See https://github.com/necolas/normalize.css/issues/214
43 |
44 | button,
45 | input,
46 | select[multiple],
47 | textarea {
48 | background-image: none;
49 | }
50 |
51 |
52 | // Links
53 |
54 | a {
55 | color: @link-color;
56 | text-decoration: none;
57 |
58 | &:hover,
59 | &:focus {
60 | color: @link-hover-color;
61 | text-decoration: underline;
62 | }
63 |
64 | &:focus {
65 | .tab-focus();
66 | }
67 | }
68 |
69 |
70 | // Images
71 |
72 | img {
73 | vertical-align: middle;
74 | }
75 |
76 | // Responsive images (ensure images don't scale beyond their parents)
77 | .img-responsive {
78 | .img-responsive();
79 | }
80 |
81 | // Rounded corners
82 | .img-rounded {
83 | border-radius: @border-radius-large;
84 | }
85 |
86 | // Image thumbnails
87 | //
88 | // Heads up! This is mixin-ed into thumbnails.less for `.thumbnail`.
89 | .img-thumbnail {
90 | padding: @thumbnail-padding;
91 | line-height: @line-height-base;
92 | background-color: @thumbnail-bg;
93 | border: 1px solid @thumbnail-border;
94 | border-radius: @thumbnail-border-radius;
95 | .transition(all .2s ease-in-out);
96 |
97 | // Keep them at most 100% wide
98 | .img-responsive(inline-block);
99 | }
100 |
101 | // Perfect circle
102 | .img-circle {
103 | border-radius: 50%; // set radius in percents
104 | }
105 |
106 |
107 | // Horizontal rules
108 |
109 | hr {
110 | margin-top: @line-height-computed;
111 | margin-bottom: @line-height-computed;
112 | border: 0;
113 | border-top: 1px solid @hr-border;
114 | }
115 |
116 |
117 | // Only display content to screen readers
118 | //
119 | // See: http://a11yproject.com/posts/how-to-hide-content/
120 |
121 | .sr-only {
122 | position: absolute;
123 | width: 1px;
124 | height: 1px;
125 | margin: -1px;
126 | padding: 0;
127 | overflow: hidden;
128 | clip: rect(0 0 0 0);
129 | border: 0;
130 | }
131 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/justified-nav/justified-nav.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 20px;
3 | }
4 |
5 | .footer {
6 | border-top: 1px solid #eee;
7 | margin-top: 40px;
8 | padding-top: 40px;
9 | padding-bottom: 40px;
10 | }
11 |
12 | /* Main marketing message and sign up button */
13 | .jumbotron {
14 | text-align: center;
15 | background-color: transparent;
16 | }
17 | .jumbotron .btn {
18 | font-size: 21px;
19 | padding: 14px 24px;
20 | }
21 |
22 | /* Customize the nav-justified links to be fill the entire space of the .navbar */
23 |
24 | .nav-justified {
25 | background-color: #eee;
26 | border-radius: 5px;
27 | border: 1px solid #ccc;
28 | }
29 | .nav-justified > li > a {
30 | padding-top: 15px;
31 | padding-bottom: 15px;
32 | color: #777;
33 | font-weight: bold;
34 | text-align: center;
35 | border-bottom: 1px solid #d5d5d5;
36 | background-color: #e5e5e5; /* Old browsers */
37 | background-repeat: repeat-x; /* Repeat the gradient */
38 | background-image: -moz-linear-gradient(top, #f5f5f5 0%, #e5e5e5 100%); /* FF3.6+ */
39 | background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(100%,#e5e5e5)); /* Chrome,Safari4+ */
40 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%,#e5e5e5 100%); /* Chrome 10+,Safari 5.1+ */
41 | background-image: -ms-linear-gradient(top, #f5f5f5 0%,#e5e5e5 100%); /* IE10+ */
42 | background-image: -o-linear-gradient(top, #f5f5f5 0%,#e5e5e5 100%); /* Opera 11.10+ */
43 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#e5e5e5',GradientType=0 ); /* IE6-9 */
44 | background-image: linear-gradient(top, #f5f5f5 0%,#e5e5e5 100%); /* W3C */
45 | }
46 | .nav-justified > .active > a,
47 | .nav-justified > .active > a:hover,
48 | .nav-justified > .active > a:focus {
49 | background-color: #ddd;
50 | background-image: none;
51 | box-shadow: inset 0 3px 7px rgba(0,0,0,.15);
52 | }
53 | .nav-justified > li:first-child > a {
54 | border-radius: 5px 5px 0 0;
55 | }
56 | .nav-justified > li:last-child > a {
57 | border-bottom: 0;
58 | border-radius: 0 0 5px 5px;
59 | }
60 |
61 | @media (min-width: 768px) {
62 | .nav-justified {
63 | max-height: 52px;
64 | }
65 | .nav-justified > li > a {
66 | border-left: 1px solid #fff;
67 | border-right: 1px solid #d5d5d5;
68 | }
69 | .nav-justified > li:first-child > a {
70 | border-left: 0;
71 | border-radius: 5px 0 0 5px;
72 | }
73 | .nav-justified > li:last-child > a {
74 | border-radius: 0 5px 5px 0;
75 | border-right: 0;
76 | }
77 | }
78 |
79 | /* Responsive: Portrait tablets and up */
80 | @media screen and (min-width: 768px) {
81 | /* Remove the padding we set earlier */
82 | .masthead,
83 | .marketing,
84 | .footer {
85 | padding-left: 0;
86 | padding-right: 0;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/less/tooltip.less:
--------------------------------------------------------------------------------
1 | //
2 | // Tooltips
3 | // --------------------------------------------------
4 |
5 |
6 | // Base class
7 | .tooltip {
8 | position: absolute;
9 | z-index: @zindex-tooltip;
10 | display: block;
11 | visibility: visible;
12 | font-size: @font-size-small;
13 | line-height: 1.4;
14 | .opacity(0);
15 |
16 | &.in { .opacity(.9); }
17 | &.top { margin-top: -3px; padding: 5px 0; }
18 | &.right { margin-left: 3px; padding: 0 5px; }
19 | &.bottom { margin-top: 3px; padding: 5px 0; }
20 | &.left { margin-left: -3px; padding: 0 5px; }
21 | }
22 |
23 | // Wrapper for the tooltip content
24 | .tooltip-inner {
25 | max-width: @tooltip-max-width;
26 | padding: 3px 8px;
27 | color: @tooltip-color;
28 | text-align: center;
29 | text-decoration: none;
30 | background-color: @tooltip-bg;
31 | border-radius: @border-radius-base;
32 | }
33 |
34 | // Arrows
35 | .tooltip-arrow {
36 | position: absolute;
37 | width: 0;
38 | height: 0;
39 | border-color: transparent;
40 | border-style: solid;
41 | }
42 | .tooltip {
43 | &.top .tooltip-arrow {
44 | bottom: 0;
45 | left: 50%;
46 | margin-left: -@tooltip-arrow-width;
47 | border-width: @tooltip-arrow-width @tooltip-arrow-width 0;
48 | border-top-color: @tooltip-arrow-color;
49 | }
50 | &.top-left .tooltip-arrow {
51 | bottom: 0;
52 | left: 5px;
53 | border-width: @tooltip-arrow-width @tooltip-arrow-width 0;
54 | border-top-color: @tooltip-arrow-color;
55 | }
56 | &.top-right .tooltip-arrow {
57 | bottom: 0;
58 | right: 5px;
59 | border-width: @tooltip-arrow-width @tooltip-arrow-width 0;
60 | border-top-color: @tooltip-arrow-color;
61 | }
62 | &.right .tooltip-arrow {
63 | top: 50%;
64 | left: 0;
65 | margin-top: -@tooltip-arrow-width;
66 | border-width: @tooltip-arrow-width @tooltip-arrow-width @tooltip-arrow-width 0;
67 | border-right-color: @tooltip-arrow-color;
68 | }
69 | &.left .tooltip-arrow {
70 | top: 50%;
71 | right: 0;
72 | margin-top: -@tooltip-arrow-width;
73 | border-width: @tooltip-arrow-width 0 @tooltip-arrow-width @tooltip-arrow-width;
74 | border-left-color: @tooltip-arrow-color;
75 | }
76 | &.bottom .tooltip-arrow {
77 | top: 0;
78 | left: 50%;
79 | margin-left: -@tooltip-arrow-width;
80 | border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;
81 | border-bottom-color: @tooltip-arrow-color;
82 | }
83 | &.bottom-left .tooltip-arrow {
84 | top: 0;
85 | left: 5px;
86 | border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;
87 | border-bottom-color: @tooltip-arrow-color;
88 | }
89 | &.bottom-right .tooltip-arrow {
90 | top: 0;
91 | right: 5px;
92 | border-width: 0 @tooltip-arrow-width @tooltip-arrow-width;
93 | border-bottom-color: @tooltip-arrow-color;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/tests/runtime.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | 'use strict';
3 |
4 | var expect, util;
5 |
6 | if(typeof require !== 'undefined') {
7 | expect = require('expect.js');
8 | util = require('./util');
9 | }
10 | else {
11 | expect = window.expect;
12 | util = window.util;
13 | }
14 |
15 | var finish = util.finish;
16 | var render = util.render;
17 |
18 | describe('runtime', function() {
19 | it('should report the failed function calls to symbols', function(done) {
20 | render('{{ foo("cvan") }}', {}, { noThrow: true }, function(err) {
21 | expect(err).to.match(/Unable to call `foo`, which is undefined/);
22 | });
23 |
24 | finish(done);
25 | });
26 |
27 | it('should report the failed function calls to lookups', function(done) {
28 | render('{{ foo["bar"]("cvan") }}', {}, { noThrow: true }, function(err) {
29 | expect(err).to.match(/foo\["bar"\]/);
30 | });
31 |
32 | finish(done);
33 | });
34 |
35 | it('should report the failed function calls to calls', function(done) {
36 | render('{{ foo.bar("second call") }}', {}, { noThrow: true }, function(err) {
37 | expect(err).to.match(/foo\["bar"\]/);
38 | });
39 |
40 | finish(done);
41 | });
42 |
43 | it('should report full function name in error', function(done) {
44 | render('{{ foo.barThatIsLongerThanTen() }}', {}, { noThrow: true }, function(err) {
45 | expect(err).to.match(/foo\["barThatIsLongerThanTen"\]/);
46 | });
47 |
48 | finish(done);
49 | });
50 |
51 | it('should report the failed function calls w/multiple args', function(done) {
52 | render('{{ foo.bar("multiple", "args") }}', {}, { noThrow: true }, function(err) {
53 | expect(err).to.match(/foo\["bar"\]/);
54 | });
55 |
56 | render('{{ foo["bar"]["zip"]("multiple", "args") }}',
57 | {},
58 | { noThrow: true },
59 | function(err) {
60 | expect(err).to.match(/foo\["bar"\]\["zip"\]/);
61 | });
62 |
63 | finish(done);
64 | });
65 |
66 | it('should allow for undefined macro arguments in the last position', function(done) {
67 | render('{% macro foo(bar, baz) %}' +
68 | '{{ bar }} {{ baz }}{% endmacro %}' +
69 | '{{ foo("hello", nosuchvar) }}',
70 | {},
71 | { noThrow: true },
72 | function(err, res) {
73 | expect(err).to.equal(null);
74 | expect(typeof res).to.be('string');
75 | });
76 |
77 | finish(done);
78 | });
79 | });
80 | })();
81 |
--------------------------------------------------------------------------------
/tests/loader.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | 'use strict';
3 |
4 | var expect, Environment, WebLoader, FileSystemLoader, templatesPath;
5 |
6 | if(typeof require !== 'undefined') {
7 | expect = require('expect.js');
8 | Environment = require('../src/environment').Environment;
9 | WebLoader = require('../src/web-loaders').WebLoader;
10 | FileSystemLoader = require('../src/node-loaders').FileSystemLoader;
11 | templatesPath = 'tests/templates';
12 | }
13 | else {
14 | expect = window.expect;
15 | Environment = nunjucks.Environment;
16 | WebLoader = nunjucks.WebLoader;
17 | FileSystemLoader = nunjucks.FileSystemLoader;
18 | templatesPath = '../templates';
19 | }
20 |
21 | describe('loader', function() {
22 | it('should have default opts', function() {
23 | var webLoader = new WebLoader(templatesPath);
24 | var fileSystemLoader = new FileSystemLoader(templatesPath);
25 | expect(webLoader).to.be.a(WebLoader);
26 | expect(webLoader.useCache).to.be(false);
27 | expect(webLoader.async).to.be(false);
28 | expect(fileSystemLoader).to.be.a(FileSystemLoader);
29 | expect(fileSystemLoader.noCache).to.be(false);
30 | });
31 |
32 | it('should allow a simple loader to be created', function() {
33 | // From Docs: http://mozilla.github.io/nunjucks/api.html#writing-a-loader
34 | // We should be able to create a loader that only exposes getSource
35 | function MyLoader() {
36 | // configuration
37 | }
38 |
39 | MyLoader.prototype.getSource = function() {
40 | return { src: 'Hello World',
41 | path: '/tmp/somewhere' };
42 | };
43 |
44 | var env = new Environment(new MyLoader(templatesPath));
45 | var parent = env.getTemplate('fake.njk');
46 | expect(parent.render()).to.be('Hello World');
47 | });
48 |
49 | it('should catch loader error', function(done) {
50 | // From Docs: http://mozilla.github.io/nunjucks/api.html#writing-a-loader
51 | // We should be able to create a loader that only exposes getSource
52 | function MyLoader() {
53 | // configuration
54 | this.async = true;
55 | }
56 |
57 | MyLoader.prototype.getSource = function(s, cb) {
58 | setTimeout(function() {
59 | cb(new Error('test'));
60 | }, 1);
61 | };
62 |
63 | var env = new Environment(new MyLoader(templatesPath));
64 | env.getTemplate('fake.njk', function(err, parent) {
65 | expect(err).to.be.a(Error);
66 | expect(parent).to.be(undefined);
67 |
68 | done();
69 | });
70 |
71 | });
72 | });
73 | })();
74 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/_layouts/default.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {% include header.html %}
6 |
7 |
8 |
9 | Skip navigation
10 |
11 |
12 | {% include nav-main.html %}
13 |
14 |
15 |
22 |
23 |
24 | {% include old-bs-docs.html %}
25 |
26 |
27 |
28 |
29 |
44 |
45 |
46 | {{ content }}
47 |
48 |
49 |
50 |
51 |
52 |
54 |
71 |
72 |
73 | {% include footer.html %}
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/alert.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: alert.js v3.0.0
3 | * http://twbs.github.com/bootstrap/javascript.html#alerts
4 | * ========================================================================
5 | * Copyright 2013 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ======================================================================== */
19 |
20 |
21 | +function ($) { "use strict";
22 |
23 | // ALERT CLASS DEFINITION
24 | // ======================
25 |
26 | var dismiss = '[data-dismiss="alert"]'
27 | var Alert = function (el) {
28 | $(el).on('click', dismiss, this.close)
29 | }
30 |
31 | Alert.prototype.close = function (e) {
32 | var $this = $(this)
33 | var selector = $this.attr('data-target')
34 |
35 | if (!selector) {
36 | selector = $this.attr('href')
37 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
38 | }
39 |
40 | var $parent = $(selector)
41 |
42 | if (e) e.preventDefault()
43 |
44 | if (!$parent.length) {
45 | $parent = $this.hasClass('alert') ? $this : $this.parent()
46 | }
47 |
48 | $parent.trigger(e = $.Event('close.bs.alert'))
49 |
50 | if (e.isDefaultPrevented()) return
51 |
52 | $parent.removeClass('in')
53 |
54 | function removeElement() {
55 | $parent.trigger('closed.bs.alert').remove()
56 | }
57 |
58 | $.support.transition && $parent.hasClass('fade') ?
59 | $parent
60 | .one($.support.transition.end, removeElement)
61 | .emulateTransitionEnd(150) :
62 | removeElement()
63 | }
64 |
65 |
66 | // ALERT PLUGIN DEFINITION
67 | // =======================
68 |
69 | var old = $.fn.alert
70 |
71 | $.fn.alert = function (option) {
72 | return this.each(function () {
73 | var $this = $(this)
74 | var data = $this.data('bs.alert')
75 |
76 | if (!data) $this.data('bs.alert', (data = new Alert(this)))
77 | if (typeof option == 'string') data[option].call($this)
78 | })
79 | }
80 |
81 | $.fn.alert.Constructor = Alert
82 |
83 |
84 | // ALERT NO CONFLICT
85 | // =================
86 |
87 | $.fn.alert.noConflict = function () {
88 | $.fn.alert = old
89 | return this
90 | }
91 |
92 |
93 | // ALERT DATA-API
94 | // ==============
95 |
96 | $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
97 |
98 | }(window.jQuery);
99 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/jumbotron-narrow/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Narrow Jumbotron Template for Bootstrap
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
36 |
37 |
38 |
Jumbotron heading
39 |
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
40 |
Sign up today
41 |
42 |
43 |
44 |
45 |
Subheading
46 |
Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.
47 |
48 |
Subheading
49 |
Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.
50 |
51 |
Subheading
52 |
Maecenas sed diam eget risus varius blandit sit amet non magna.
53 |
54 |
55 |
56 |
Subheading
57 |
Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.
58 |
59 |
Subheading
60 |
Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.
61 |
62 |
Subheading
63 |
Maecenas sed diam eget risus varius blandit sit amet non magna.
64 |
65 |
66 |
67 |
70 |
71 |
72 |
73 |
74 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/non-responsive/non-responsive.css:
--------------------------------------------------------------------------------
1 |
2 | /* Template-specific stuff
3 | *
4 | * Customizations just for the template—these are not necessary for anything
5 | * with disabling the responsiveness.
6 | */
7 |
8 | /* Account for fixed navbar */
9 | body {
10 | padding-top: 70px;
11 | padding-bottom: 30px;
12 | }
13 |
14 | /* Finesse the page header spacing */
15 | .page-header {
16 | margin-bottom: 30px;
17 | }
18 | .page-header .lead {
19 | margin-bottom: 10px;
20 | }
21 |
22 |
23 | /* Non-responsive overrides
24 | *
25 | * Utilitze the following CSS to disable the responsive-ness of the container,
26 | * grid system, and navbar.
27 | */
28 |
29 | /* Reset the container */
30 | .container {
31 | max-width: none !important;
32 | width: 970px;
33 | }
34 |
35 | /* Demonstrate the grids */
36 | .col-xs-4 {
37 | padding-top: 15px;
38 | padding-bottom: 15px;
39 | background-color: #eee;
40 | border: 1px solid #ddd;
41 | background-color: rgba(86,61,124,.15);
42 | border: 1px solid rgba(86,61,124,.2);
43 | }
44 |
45 | .container .navbar-header,
46 | .container .navbar-collapse {
47 | margin-right: 0;
48 | margin-left: 0;
49 | }
50 |
51 | /* Always float the navbar header */
52 | .navbar-header {
53 | float: left;
54 | }
55 |
56 | /* Undo the collapsing navbar */
57 | .navbar-collapse {
58 | display: block !important;
59 | height: auto !important;
60 | padding-bottom: 0;
61 | overflow: visible !important;
62 | }
63 |
64 | .navbar-toggle {
65 | display: none;
66 | }
67 |
68 | .navbar-brand {
69 | margin-left: -15px;
70 | }
71 |
72 | /* Always apply the floated nav */
73 | .navbar-nav {
74 | float: left;
75 | margin: 0;
76 | }
77 | .navbar-nav > li {
78 | float: left;
79 | }
80 | .navbar-nav > li > a {
81 | padding: 15px;
82 | }
83 |
84 | /* Redeclare since we override the float above */
85 | .navbar-nav.navbar-right {
86 | float: right;
87 | }
88 |
89 | /* Undo custom dropdowns */
90 | .navbar .open .dropdown-menu {
91 | position: absolute;
92 | float: left;
93 | background-color: #fff;
94 | border: 1px solid #cccccc;
95 | border: 1px solid rgba(0, 0, 0, 0.15);
96 | border-width: 0 1px 1px;
97 | border-radius: 0 0 4px 4px;
98 | -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
99 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
100 | }
101 | .navbar .open .dropdown-menu > li > a {
102 | color: #333;
103 | }
104 | .navbar .open .dropdown-menu > li > a:hover,
105 | .navbar .open .dropdown-menu > li > a:focus,
106 | .navbar .open .dropdown-menu > .active > a,
107 | .navbar .open .dropdown-menu > .active > a:hover,
108 | .navbar .open .dropdown-menu > .active > a:focus {
109 | color: #fff !important;
110 | background-color: #428bca !important;
111 | }
112 | .navbar .open .dropdown-menu > .disabled > a,
113 | .navbar .open .dropdown-menu > .disabled > a:hover,
114 | .navbar .open .dropdown-menu > .disabled > a:focus {
115 | color: #999 !important;
116 | background-color: transparent !important;
117 | }
118 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/carousel/carousel.css:
--------------------------------------------------------------------------------
1 | /* GLOBAL STYLES
2 | -------------------------------------------------- */
3 | /* Padding below the footer and lighter body text */
4 |
5 | body {
6 | padding-bottom: 40px;
7 | color: #5a5a5a;
8 | }
9 |
10 |
11 |
12 | /* CUSTOMIZE THE NAVBAR
13 | -------------------------------------------------- */
14 |
15 | /* Special class on .container surrounding .navbar, used for positioning it into place. */
16 | .navbar-wrapper {
17 | position: relative;
18 | z-index: 15;
19 | }
20 |
21 |
22 | /* CUSTOMIZE THE CAROUSEL
23 | -------------------------------------------------- */
24 |
25 | /* Carousel base class */
26 | .carousel {
27 | margin-bottom: 60px;
28 |
29 | /* Negative margin to pull up carousel. 90px is roughly margins and height of navbar. */
30 | margin-top: -90px;
31 | }
32 | /* Since positioning the image, we need to help out the caption */
33 | .carousel-caption {
34 | z-index: 10;
35 | }
36 |
37 | /* Declare heights because of positioning of img element */
38 | .carousel .item {
39 | height: 500px;
40 | background-color: #777;
41 | }
42 | .carousel-inner > .item > img {
43 | position: absolute;
44 | top: 0;
45 | left: 0;
46 | min-width: 100%;
47 | height: 500px;
48 | }
49 |
50 |
51 |
52 | /* MARKETING CONTENT
53 | -------------------------------------------------- */
54 |
55 | /* Pad the edges of the mobile views a bit */
56 | .marketing {
57 | padding-left: 15px;
58 | padding-right: 15px;
59 | }
60 |
61 | /* Center align the text within the three columns below the carousel */
62 | .marketing .col-lg-4 {
63 | text-align: center;
64 | margin-bottom: 20px;
65 | }
66 | .marketing h2 {
67 | font-weight: normal;
68 | }
69 | .marketing .col-lg-4 p {
70 | margin-left: 10px;
71 | margin-right: 10px;
72 | }
73 |
74 |
75 | /* Featurettes
76 | ------------------------- */
77 |
78 | .featurette-divider {
79 | margin: 80px 0; /* Space out the Bootstrap more */
80 | }
81 |
82 | /* Thin out the marketing headings */
83 | .featurette-heading {
84 | font-weight: 300;
85 | line-height: 1;
86 | letter-spacing: -1px;
87 | }
88 |
89 |
90 |
91 | /* RESPONSIVE CSS
92 | -------------------------------------------------- */
93 |
94 | @media (min-width: 768px) {
95 |
96 | /* Remove the edge padding needed for mobile */
97 | .marketing {
98 | padding-left: 0;
99 | padding-right: 0;
100 | }
101 |
102 | /* Navbar positioning foo */
103 | .navbar-wrapper {
104 | margin-top: 20px;
105 | }
106 | /* The navbar becomes detached from the top, so we round the corners */
107 | .navbar-wrapper .navbar {
108 | border-radius: 4px;
109 | }
110 |
111 | /* Bump up size of carousel content */
112 | .carousel-caption p {
113 | margin-bottom: 20px;
114 | font-size: 21px;
115 | line-height: 1.4;
116 | }
117 |
118 | .featurette-heading {
119 | font-size: 50px;
120 | }
121 |
122 | }
123 |
124 | @media (min-width: 992px) {
125 | .featurette-heading {
126 | margin-top: 120px;
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to Bootstrap
2 |
3 | Looking to contribute something to Bootstrap? **Here's how you can help.**
4 |
5 |
6 |
7 | ## Reporting issues
8 |
9 | We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems that we can fix within the Bootstrap core. Please read the following guidelines before opening any issue.
10 |
11 | 1. **Search for existing issues.** We get a lot of duplicate issues, and you'd help us out a lot by first checking if someone else has reported the same issue. Moreover, the issue may have already been resolved with a fix available.
12 | 2. **Create an isolated and reproducible test case.** Be sure the problem exists in Bootstrap's code with a [reduced test case](http://css-tricks.com/reduced-test-cases/) that should be included in each bug report.
13 | 3. **Include a live example.** Make use of jsFiddle or jsBin to share your isolated test cases.
14 | 4. **Share as much information as possible.** Include operating system and version, browser and version, version of Bootstrap, customized or vanilla build, etc. where appropriate. Also include steps to reproduce the bug.
15 |
16 |
17 |
18 | ## Key branches
19 |
20 | - `master` is the latest, deployed version.
21 | - `gh-pages` is the hosted docs (not to be used for pull requests).
22 | - `*-wip` is the official work in progress branch for the next release.
23 |
24 |
25 |
26 | ## Pull requests
27 |
28 | - Try to submit pull requests against the latest `*-wip` branch for easier merging
29 | - CSS changes must be done in .less files first, never just the compiled files
30 | - If modifying the .less files, always recompile and commit the compiled files bootstrap.css and bootstrap.min.css
31 | - Try not to pollute your pull request with unintended changes--keep them simple and small
32 | - Try to share which browsers your code has been tested in before submitting a pull request
33 |
34 |
35 |
36 | ## Coding standards
37 |
38 | ### HTML
39 |
40 | - Two spaces for indentation, never tabs
41 | - Double quotes only, never single quotes
42 | - Always use proper indentation
43 | - Use tags and elements appropriate for an HTML5 doctype (e.g., self-closing tags)
44 |
45 | ### CSS
46 |
47 | - Adhere to the [Recess CSS property order](http://markdotto.com/2011/11/29/css-property-order/)
48 | - Multiple-line approach (one property and value per line)
49 | - Always a space after a property's colon (.e.g, `display: block;` and not `display:block;`)
50 | - End all lines with a semi-colon
51 | - For multiple, comma-separated selectors, place each selector on its own line
52 | - Attribute selectors, like `input[type="text"]` should always wrap the attribute's value in double quotes, for consistency and safety (see this [blog post on unquoted attribute values](http://mathiasbynens.be/notes/unquoted-attribute-values) that can lead to XSS attacks).
53 |
54 | ### JS
55 |
56 | - No semicolons
57 | - Comma first
58 | - 2 spaces (no tabs)
59 | - strict mode
60 | - "Attractive"
61 |
62 |
63 |
64 | ## License
65 |
66 | By contributing your code, you agree to license your contribution under the terms of the APLv2: https://github.com/twbs/bootstrap/blob/master/LICENSE
67 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/tests/unit/tab.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 |
3 | module("tabs")
4 |
5 | test("should provide no conflict", function () {
6 | var tab = $.fn.tab.noConflict()
7 | ok(!$.fn.tab, 'tab was set back to undefined (org value)')
8 | $.fn.tab = tab
9 | })
10 |
11 | test("should be defined on jquery object", function () {
12 | ok($(document.body).tab, 'tabs method is defined')
13 | })
14 |
15 | test("should return element", function () {
16 | ok($(document.body).tab()[0] == document.body, 'document.body returned')
17 | })
18 |
19 | test("should activate element by tab id", function () {
20 | var tabsHTML =
21 | ''
25 |
26 | $('').appendTo("#qunit-fixture")
27 |
28 | $(tabsHTML).find('li:last a').tab('show')
29 | equals($("#qunit-fixture").find('.active').attr('id'), "profile")
30 |
31 | $(tabsHTML).find('li:first a').tab('show')
32 | equals($("#qunit-fixture").find('.active').attr('id'), "home")
33 | })
34 |
35 | test("should activate element by tab id", function () {
36 | var pillsHTML =
37 | ''
41 |
42 | $('').appendTo("#qunit-fixture")
43 |
44 | $(pillsHTML).find('li:last a').tab('show')
45 | equals($("#qunit-fixture").find('.active').attr('id'), "profile")
46 |
47 | $(pillsHTML).find('li:first a').tab('show')
48 | equals($("#qunit-fixture").find('.active').attr('id'), "home")
49 | })
50 |
51 |
52 | test("should not fire closed when close is prevented", function () {
53 | $.support.transition = false
54 | stop();
55 | $('
')
56 | .on('show.bs.tab', function (e) {
57 | e.preventDefault();
58 | ok(true);
59 | start();
60 | })
61 | .on('shown.bs.tab', function () {
62 | ok(false);
63 | })
64 | .tab('show')
65 | })
66 |
67 | test("show and shown events should reference correct relatedTarget", function () {
68 | var dropHTML =
69 | ''
70 | + '1 '
71 | + ''
75 | + ' '
76 | + ' '
77 |
78 | $(dropHTML).find('ul>li:first a').tab('show').end()
79 | .find('ul>li:last a').on('show', function(event){
80 | equals(event.relatedTarget.hash, "#1-1")
81 | }).on('shown', function(event){
82 | equals(event.relatedTarget.hash, "#1-1")
83 | }).tab('show')
84 | })
85 |
86 | })
87 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/assets/css/pygments-manni.css:
--------------------------------------------------------------------------------
1 | .hll { background-color: #ffffcc }
2 | /*{ background: #f0f3f3; }*/
3 | .c { color: #999; } /* Comment */
4 | .err { color: #AA0000; background-color: #FFAAAA } /* Error */
5 | .k { color: #006699; } /* Keyword */
6 | .o { color: #555555 } /* Operator */
7 | .cm { color: #0099FF; font-style: italic } /* Comment.Multiline */
8 | .cp { color: #009999 } /* Comment.Preproc */
9 | .c1 { color: #999; } /* Comment.Single */
10 | .cs { color: #999; } /* Comment.Special */
11 | .gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */
12 | .ge { font-style: italic } /* Generic.Emph */
13 | .gr { color: #FF0000 } /* Generic.Error */
14 | .gh { color: #003300; } /* Generic.Heading */
15 | .gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */
16 | .go { color: #AAAAAA } /* Generic.Output */
17 | .gp { color: #000099; } /* Generic.Prompt */
18 | .gs { } /* Generic.Strong */
19 | .gu { color: #003300; } /* Generic.Subheading */
20 | .gt { color: #99CC66 } /* Generic.Traceback */
21 | .kc { color: #006699; } /* Keyword.Constant */
22 | .kd { color: #006699; } /* Keyword.Declaration */
23 | .kn { color: #006699; } /* Keyword.Namespace */
24 | .kp { color: #006699 } /* Keyword.Pseudo */
25 | .kr { color: #006699; } /* Keyword.Reserved */
26 | .kt { color: #007788; } /* Keyword.Type */
27 | .m { color: #FF6600 } /* Literal.Number */
28 | .s { color: #d44950 } /* Literal.String */
29 | .na { color: #4f9fcf } /* Name.Attribute */
30 | .nb { color: #336666 } /* Name.Builtin */
31 | .nc { color: #00AA88; } /* Name.Class */
32 | .no { color: #336600 } /* Name.Constant */
33 | .nd { color: #9999FF } /* Name.Decorator */
34 | .ni { color: #999999; } /* Name.Entity */
35 | .ne { color: #CC0000; } /* Name.Exception */
36 | .nf { color: #CC00FF } /* Name.Function */
37 | .nl { color: #9999FF } /* Name.Label */
38 | .nn { color: #00CCFF; } /* Name.Namespace */
39 | .nt { color: #2f6f9f; } /* Name.Tag */
40 | .nv { color: #003333 } /* Name.Variable */
41 | .ow { color: #000000; } /* Operator.Word */
42 | .w { color: #bbbbbb } /* Text.Whitespace */
43 | .mf { color: #FF6600 } /* Literal.Number.Float */
44 | .mh { color: #FF6600 } /* Literal.Number.Hex */
45 | .mi { color: #FF6600 } /* Literal.Number.Integer */
46 | .mo { color: #FF6600 } /* Literal.Number.Oct */
47 | .sb { color: #CC3300 } /* Literal.String.Backtick */
48 | .sc { color: #CC3300 } /* Literal.String.Char */
49 | .sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */
50 | .s2 { color: #CC3300 } /* Literal.String.Double */
51 | .se { color: #CC3300; } /* Literal.String.Escape */
52 | .sh { color: #CC3300 } /* Literal.String.Heredoc */
53 | .si { color: #AA0000 } /* Literal.String.Interpol */
54 | .sx { color: #CC3300 } /* Literal.String.Other */
55 | .sr { color: #33AAAA } /* Literal.String.Regex */
56 | .s1 { color: #CC3300 } /* Literal.String.Single */
57 | .ss { color: #FFCC33 } /* Literal.String.Symbol */
58 | .bp { color: #336666 } /* Name.Builtin.Pseudo */
59 | .vc { color: #003333 } /* Name.Variable.Class */
60 | .vg { color: #003333 } /* Name.Variable.Global */
61 | .vi { color: #003333 } /* Name.Variable.Instance */
62 | .il { color: #FF6600 } /* Literal.Number.Integer.Long */
63 |
64 | .css .o,
65 | .css .o + .nt,
66 | .css .nt + .nt { color: #999; }
67 |
--------------------------------------------------------------------------------
/src/web-loaders.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var Loader = require('./loader');
4 | var PrecompiledLoader = require('./precompiled-loader.js');
5 |
6 | var WebLoader = Loader.extend({
7 | init: function(baseURL, opts) {
8 | this.baseURL = baseURL || '.';
9 | opts = opts || {};
10 |
11 | // By default, the cache is turned off because there's no way
12 | // to "watch" templates over HTTP, so they are re-downloaded
13 | // and compiled each time. (Remember, PRECOMPILE YOUR
14 | // TEMPLATES in production!)
15 | this.useCache = !!opts.useCache;
16 |
17 | // We default `async` to false so that the simple synchronous
18 | // API can be used when you aren't doing anything async in
19 | // your templates (which is most of the time). This performs a
20 | // sync ajax request, but that's ok because it should *only*
21 | // happen in development. PRECOMPILE YOUR TEMPLATES.
22 | this.async = !!opts.async;
23 | },
24 |
25 | resolve: function(from, to) { // jshint ignore:line
26 | throw new Error('relative templates not support in the browser yet');
27 | },
28 |
29 | getSource: function(name, cb) {
30 | var useCache = this.useCache;
31 | var result;
32 | this.fetch(this.baseURL + '/' + name, function(err, src) {
33 | if(err) {
34 | if(cb) {
35 | cb(err.content);
36 | } else {
37 | if (err.status === 404) {
38 | result = null;
39 | } else {
40 | throw err.content;
41 | }
42 | }
43 | }
44 | else {
45 | result = { src: src,
46 | path: name,
47 | noCache: !useCache };
48 | if(cb) {
49 | cb(null, result);
50 | }
51 | }
52 | });
53 |
54 | // if this WebLoader isn't running asynchronously, the
55 | // fetch above would actually run sync and we'll have a
56 | // result here
57 | return result;
58 | },
59 |
60 | fetch: function(url, cb) {
61 | // Only in the browser please
62 | var ajax;
63 | var loading = true;
64 |
65 | if(window.XMLHttpRequest) { // Mozilla, Safari, ...
66 | ajax = new XMLHttpRequest();
67 | }
68 | else if(window.ActiveXObject) { // IE 8 and older
69 | /* global ActiveXObject */
70 | ajax = new ActiveXObject('Microsoft.XMLHTTP');
71 | }
72 |
73 | ajax.onreadystatechange = function() {
74 | if(ajax.readyState === 4 && loading) {
75 | loading = false;
76 | if(ajax.status === 0 || ajax.status === 200) {
77 | cb(null, ajax.responseText);
78 | }
79 | else {
80 | cb({ status: ajax.status, content: ajax.responseText });
81 | }
82 | }
83 | };
84 |
85 | url += (url.indexOf('?') === -1 ? '?' : '&') + 's=' +
86 | (new Date().getTime());
87 |
88 | ajax.open('GET', url, this.async);
89 | ajax.send();
90 | }
91 | });
92 |
93 | module.exports = {
94 | WebLoader: WebLoader,
95 | PrecompiledLoader: PrecompiledLoader
96 | };
97 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/justified-nav/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Justified Nav Template for Bootstrap
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
40 |
41 |
42 |
43 |
Marketing stuff!
44 |
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet.
45 |
Get started today
46 |
47 |
48 |
49 |
50 |
51 |
Heading
52 |
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
53 |
View details »
54 |
55 |
56 |
Heading
57 |
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
58 |
View details »
59 |
60 |
61 |
Heading
62 |
Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa.
63 |
View details »
64 |
65 |
66 |
67 |
68 |
71 |
72 |
73 |
74 |
75 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/examples/navbar/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Navbar Template for Bootstrap
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
64 |
65 |
66 |
67 |
Navbar example
68 |
This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.
69 |
70 | View navbar docs »
71 |
72 |
73 |
74 |
75 |
76 |
77 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/docs/bower_components/bootstrap/js/button.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: button.js v3.0.0
3 | * http://twbs.github.com/bootstrap/javascript.html#buttons
4 | * ========================================================================
5 | * Copyright 2013 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ======================================================================== */
19 |
20 |
21 | +function ($) { "use strict";
22 |
23 | // BUTTON PUBLIC CLASS DEFINITION
24 | // ==============================
25 |
26 | var Button = function (element, options) {
27 | this.$element = $(element)
28 | this.options = $.extend({}, Button.DEFAULTS, options)
29 | }
30 |
31 | Button.DEFAULTS = {
32 | loadingText: 'loading...'
33 | }
34 |
35 | Button.prototype.setState = function (state) {
36 | var d = 'disabled'
37 | var $el = this.$element
38 | var val = $el.is('input') ? 'val' : 'html'
39 | var data = $el.data()
40 |
41 | state = state + 'Text'
42 |
43 | if (!data.resetText) $el.data('resetText', $el[val]())
44 |
45 | $el[val](data[state] || this.options[state])
46 |
47 | // push to event loop to allow forms to submit
48 | setTimeout(function () {
49 | state == 'loadingText' ?
50 | $el.addClass(d).attr(d, d) :
51 | $el.removeClass(d).removeAttr(d);
52 | }, 0)
53 | }
54 |
55 | Button.prototype.toggle = function () {
56 | var $parent = this.$element.closest('[data-toggle="buttons"]')
57 |
58 | if ($parent.length) {
59 | var $input = this.$element.find('input')
60 | .prop('checked', !this.$element.hasClass('active'))
61 | .trigger('change')
62 | if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
63 | }
64 |
65 | this.$element.toggleClass('active')
66 | }
67 |
68 |
69 | // BUTTON PLUGIN DEFINITION
70 | // ========================
71 |
72 | var old = $.fn.button
73 |
74 | $.fn.button = function (option) {
75 | return this.each(function () {
76 | var $this = $(this)
77 | var data = $this.data('bs.button')
78 | var options = typeof option == 'object' && option
79 |
80 | if (!data) $this.data('bs.button', (data = new Button(this, options)))
81 |
82 | if (option == 'toggle') data.toggle()
83 | else if (option) data.setState(option)
84 | })
85 | }
86 |
87 | $.fn.button.Constructor = Button
88 |
89 |
90 | // BUTTON NO CONFLICT
91 | // ==================
92 |
93 | $.fn.button.noConflict = function () {
94 | $.fn.button = old
95 | return this
96 | }
97 |
98 |
99 | // BUTTON DATA-API
100 | // ===============
101 |
102 | $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
103 | var $btn = $(e.target)
104 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
105 | $btn.button('toggle')
106 | e.preventDefault()
107 | })
108 |
109 | }(window.jQuery);
110 |
--------------------------------------------------------------------------------